Welcome to the SQL Server JDBC blog

Welcome to the SQL Server JDBC blog

  • Comments 84

Unsure of what to specify in the connection URL? Having trouble configuring the driver for Integrated Authentication? Confused about some behavior with the Microsoft SQL Server JDBC driver? Then, this is the blog site for you.

The SQL Server JDBC team maintains this blog.  The team is responsible for all things regarding JDBC with SQL Server.  We hope to use this blog to proactively provide answers to many of the re-occuring issues that we see our customers face.  We will also use this blog to provide some insight into features in planning for future releases.

Hopefully you will find this useful.

SQL Server JDBC team
Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights

Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
  • I have the same question as Diana above.  Does anybody have a response for this?   Diana,  were you able to get an answer outside this blog?

  • i am having an issue while using JDBC driver to connect to MSSQL2000 server


  • I'm trying to connect with integrated security using the 2005 JDBC driver. Here is the error message:  Error creating JDBC Connection to RLID.

    (Error: This driver is not configured for integrated authentication.)  I've installed sqljdbc_auth.dll in my Eclipse folder, and in the windows/system32 folder.  I don't have any problems connecting with Windows Authentication using SQL Management Studio.  Intermittently, the connection will succeed even after throwing the error message.

  • I am trying to  connect Sun Application Server 8 to MS SQL 2005.  I can currently connect to SQL 2000 just fine and I am wondering if there are any differences that need to be taken into account -- Class Names, Resource Types, etc.


  • I am trying to  connect Sun Application Server 8 to MS SQL 2005.  I can currently connect to SQL 2000 just fine and I am wondering if there are any differences that need to be taken into account -- Class Names, Resource Types, etc.



    (Sorry I forgot this) I am currently getting this error when trying to Ping using a connection pool:

    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection could not be allocated because: Network error IOException: Connection refused: no further information

  • Hi Colby,

    Which JDBC driver are you currently using to connect to SQL Server 2000?

    If you are already using the SQL Server 2005 JDBC driver then you only need to point the application to SQL Server 2005.

    If you are using a different driver you will need to update the class name.  An simple example would look like:


     String connectionUrl = "jdbc:sqlserver://localhost;database=AdventureWorks;integratedSecurity=true;"

     Connection con = DriverManager.getConnection(connectionUrl);

    Regarding the exception you are getting, I would recommend that you try to create a standalone application outside of the Sun Application Server 8 to make sure you have the right connection string and application settings to connect to SQL Server 2005.

    You will also want to make sure SQL Server 2005 is properly configured to listen to remote TCP connections.  The typical TCP port that SQL Server 2005 listens on is 1433.  Make sure that the Windows OS firewall on SQL Server 2005 machine is not blocking the TCP port.

    If SQL Server 2005 is installed as a named instance and you are specifying the instance name on the connection string, please make sure the SQLBrowser service is running on the SQL Server 2005 machine and Windows firewall is not blocking UDP 1434.


    Jimmy Wu

  • I cannot access SQL Server 2K5 through eclipse or through the command line using sqlcmd or osql. I keep getting connection refused. I'm on Vista Ultimate working locally. Management Studio gets through perfectly of course because it is Microsoft technology made to work perfectly with Microsoft technology: seamlessly, flawlessly and magically. Everything else (non-Microsoft technology)takes forty-seven hours of configuration and hacking.

  • Can you say what error you are seeing? Also, have tried the steps provided by Jimmy above.


    C:\Users\Roger Blackmar>osql -U jboss


    [SQL Native Client]Named Pipes Provider: Could not open a connection to SQL

    Server [2].

    [SQL Native Client]Login timeout expired

    [SQL Native Client]An error has occurred while establishing a connection to

    the server. When connecting to SQL Server 2005, this failure may be caused by

    the fact that under the default settings SQL Server does not allow remote


  • FROM Eclipse:

    com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection refused: connect

    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)

    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)

    at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:89)

    at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:104)

    at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53)

    at org.eclipse.datatools.enablement.msft.internal.sqlserver.connection.JDBCSQLServerConnectionFactory.createConnection(JDBCSQLServerConnectionFactory.java:27)

    at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)

    at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:355)

    at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)

    at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)

    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

  • It is not getting to the authentication handshake it is refusing the connection, outright. Management Studio connects immediately without a problem.

  • Hi Roger,

    You mentioned that you are working locally, is SQL Server configured with TCP enabled?

    For security reasons, by default SQL Server does not enable remote TCP/IP or Named Pipe connection support when initially installed.  This may explain why both Eclipse and OSQL can not connect to SQL Server, while the Management Studio application can.

    Please double check the configuration of SQL Server and also please post the connection URL you are using to connect to SQL Server.



  • Thank you for responding. I resolved the issue by un/reinstalling SQL Server 2005.

    I noticed when reinstalling that there are some IIS 7 components on Vista (same for Server 2008) that you have to manually install through "Turn Windows features on or off". Here is the info for that:(http://learn.iis.net/page.aspx/28/installing-iis-70-on-windows-vista)

    It is working perfectly now in Eclipse.

  • if any one know about this thing that windows authentication is possible using hibernate for mssql 2005 please give me the information how i will change my hibernate config file i used jtds

    hibernate.cfg file

    <?xml version='1.0' encoding='utf-8'?>

    <!DOCTYPE hibernate-configuration PUBLIC

    "-//Hibernate/Hibernate Configuration DTD//EN"



    <session-factory name="java:comp/env/hibernate/SessionFactory">

         <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>

         <property name="hibernate.connection.url">jdbc:jtds:sqlserver://;databaseName=eventsdb;integrated security=true</property>

         <property name="hibernate.connection.username"></property>

         <property name="hibernate.connection.password"></property>

         <property name="hibernate.connection.pool_size">10</property>

         <property name="connection.autocommit">false</property>

         <property name="show_sql">true</property>

         <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>

          <mapping resource="esq/connector/dataobjects/user.hbm.xml"/>



    and i copy all the jar file jtds.jar and native jar or ntlmauth.dll file in system32 or i have given the path in enviroment variable also..i have done all the thing carefully but still

    i am getting error

    "Login failed for user ''. The user is not associated with a trusted SQL Server connection."

  • if u got any solution plz reply me my id

    EMAIL ME:-raj1112@oneindia.in

Page 2 of 6 (84 items) 12345»