facebook

jdbc connection to sql server

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #262551 Reply

    ankisettyk
    Member

    when i am trying to establish a jdbc connection with sql server 2005, am getting error as
    The Tcp/Ip connection to the host has failed. java.net.Connect Exception:
    Connection refused:connect

    #262552 Reply

    Haris Peco
    Member

    ankisettyk,

    Please, check next :

    – if your database enabled for tcp/ip access (it is not default enabled for sql server)
    – is your correct URL (host and port name)
    – you set correct sql server jdbc driver (there are microsoft jdbc driver and open source jTDS driver) and driver class

    If this doesn’t help, please send us more details :

    – your jdbc driver and version
    – driver info : class name
    – connection profile info : URL

    Regards,

    #262610 Reply

    ankisettyk
    Member

    i tried to enable my database for tcp ip access, it is generating the following error
    an error has occured while establishing a connection to the server.when connecting to the sqlserver 2005,
    this failure may be caused by the fact that under the default settings SQL server doesnot allow remote connections.(Microsoft SQL server,Error :10060)

    am using the following driver
    jdbc driver –sqljdbc.jar(sqljdbc _1.1)
    class name — Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”);
    URL—String connectionUrl = “jdbc:sqlserver://localhost:1433;” +
    “databaseName=AdventureWorks;user=sa;password=bootay”;

    #262760 Reply

    Haris Peco
    Member

    ankisettyk,

    Try set TCP/IP with SQL Server Configuration Manager

    – expand ‘SQL server 2005 Network’ configration and click on ‘Protocols to MSSQL Server’
    – right click on TCP/IP and choose ‘Enable’
    – in Properties dialog choose IP adresses and set TCP/IP port to 1433 (or what you want, but this is port in your URL).Set Enable to Yes.
    – restart SQL Server
    – Your server have be install in mixed mode (I supposet that it is default on SQL Server Express)

    Sorry for delay

    Regards,

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: jdbc connection to sql server

You must be logged in to post in the forum log in