Welcome to the SQL Server JDBC blog

Welcome to the SQL Server JDBC blog

  • Comments 77

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 3 and type the answer here:
  • Post
  • I am getting Error - com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server returned an incomplete response. The connection has been closed."

    when trying to use the Microsoft SQL Server JDBC Driver 2.0 or 3.0 with JRE 1.6.0. I am using sqljdbc4.jar with JRE 1.6.0. Connection to the same database works fine when using JRE 1.5.0 and sqljdbc.jar. Any clues?

  • Hi Indranil and Seshasai,

    Assuming that the only thing you change is the JRE and the driver JAR being used, if you are able to connect with one JRE, but not the other, that usually points to some problem with the JRE installation.

    What JRE vendor and version are you using?  Check the output from:

    System.out.println(System.getProperty("java.version"));

    System.out.println(System.getProperty("java.vendor"));

    If you have multiple JRE's installed, verify that you are using the one that you intend to by checking its installation directory.  Check the output from:

    System.out.println(System.getProperty("java.home"));

    In the 1.6.0 JRE installation, look for the lib/security/java.security file and compare it to the same file from the working 1.5.0 JRE installation.  What are the differences between the files?

    Regards,

    --David Olix [SQL Server]

  • Hello using a esri portal application that is causing me the following error message:

    "Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jbdc:sqlserver://BMH9K1S\SQLEXPRESS:1433;databaseName=geoportal931' "

    Operating system XP, tomcat6 with SQLEXPRESS 2005. With the latest sqljdbc.jar ver2 put into C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\catalina\lib.

    The log files are telling me there is a issue with JDBC. See below:

    "Caused by: java.sql.SQLException: No suitable driver

    at java.sql.DriverManager.getDriver(Unknown Source)

    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)

    ... 37 more"

    08/04/2010 8:54:27 AM com.esri.gpt.framework.sql.DatabaseReference testConnection

    SEVERE: Connection test failed.

    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jbdc:sqlserver://BMH9K1S\SQLEXPRESS:1433;databaseName=geoportal931'

    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)

    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)

    at com.esri.gpt.framework.sql.DatabaseReference.openJndiConnection(DatabaseReference.java:269)

    at com.esri.gpt.framework.sql.DatabaseReference.openConnection(DatabaseReference.java:223)

    at com.esri.gpt.framework.sql.DatabaseReference.testConnection(DatabaseReference.java:303)

    at com.esri.gpt.framework.sql.DatabaseReferences.add(DatabaseReferences.java:79)

    at com.esri.gpt.framework.context.ApplicationConfigurationLoader.loadDatabase(ApplicationConfigurationLoader.java:374)

    at com.esri.gpt.framework.context.ApplicationConfigurationLoader.load(ApplicationConfigurationLoader.java:116)

    at com.esri.gpt.framework.context.ApplicationContext.loadConfiguration(ApplicationContext.java:71)

    at com.esri.gpt.framework.context.ApplicationContext.getInstance(ApplicationContext.java:57)

    at com.esri.gpt.framework.context.InitializationServlet.init(InitializationServlet.java:50)

    at javax.servlet.GenericServlet.init(GenericServlet.java:212)

    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)

    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)

    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)

    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)

    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)

    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)

    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)

    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)

    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)

    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)

    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)

    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)

    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)

    at org.apache.catalina.core.StandardService.start(StandardService.java:516)

    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

    at org.apache.catalina.startup.Catalina.start(Catalina.java:566)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

    Caused by: java.sql.SQLException: No suitable driver

    at java.sql.DriverManager.getDriver(Unknown Source)

    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)

    ... 37 more

    The script to make the connection is in a XML which must call java in the application somehow. The XML is below.

    Would anyone happen to notice some syntax errors?

    geoportal.xml that calls web application..

    <Context docBase="geoportal" path="/geoportal" debug="0" reloadable="true" crossContext="true">

             <Resource name="jdbc/gpt" auth="Container" type="javax.sql.DataSource"

                    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"

                    url="jbdc:sqlserver://BMH9K1S\SQLEXPRESS:1433;databaseName=geoportal931"

    username="geoportal931"

    password="geoportal931pwd"

                    maxActive="20"

                    maxIdle="10"

                    maxWait="-1" />

            </Context>

    Thanks in advance

  • Thank you for using Microsoft SQL Server JDBC driver. This kind of question is best suited for our Data Access Forum (http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/threads) where various team members as well users can reply or if you would like to get help from our CSS then you can contact them at: http://support.microsoft.com/select/?LN=en-us&target=assistance&x=5&y=9

    Thanks

    Amina

  • I am getting the following error while connecting to ms sql server 2005. i am using eclipse ide. can u provide me with detailed steps about how to connect to mssql server 2005 in a java project.

    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

    at java.lang.Class.forName0(Native Method)

    at java.lang.Class.forName(Unknown Source)

    at Connect.getConnection(Connect.java:24)

    at Connect.displayDbProperties(Connect.java:42)

    at Connect.main(Connect.java:78)

    Error Trace in getConnection() : com.microsoft.jdbc.sqlserver.SQLServerDriver

    Error: No active Connection

  • HI, when i connect ms sql2005 with sun application server i'm getting the error as

     " Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: Connection could not be allocated because: The TCP/IP connection to the host PC, port 1433 has failed. Error: Connection refused: no further information. Please verify the connection properties and check that a SQL Server instance is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port."

  • Hi, when i am trying to connect eclipse with SQL Server 2005, i am getting following Error

    java.sql.SQLException: No suitable driver found for com.microsoft.sqlserver.jdbc.SQLServerDriver

    in Class.forName syntax.. any help will be great..

  • hi,

    i am coding in eclipse to access a database on the sql server. i have used the jdbc plugin -sqljdbc_3.0 and sql server 2008 R2. i am not able to get the connection right. it saya that there was a communication error:

    SQL Exception: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

    can anyone please help me out?

  • Hi there,

    Are there any known issues when using jdbc drivers to connect to 64 bit Windows 2008 R2 / SQL Server 2008 R2 failover clusters?

  • Hi

    I am using  JDBC 4 in Eclipse with MS SQL Server express 2008. I am getting this error in Eclipse, It is strange since I don't get any error when I use Netbeans. it would be great to have your hints and helps.

    com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset ClientConnectionId:793c3c64-0b9a-4f44-a4fc-1a75f007a911

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1686)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1673)

    at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1743)

    at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:4716)

    at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6021)

    at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:5973)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2907)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2242)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2228)

    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5574)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1734)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1355)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1022)

    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:858)

    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)

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

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

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

    at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:73)

    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:359)

    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:54)

    Best Regards,

    Shahrooz

  • @Shahrooz Sabet

    Can you post your question on the Data access forums so they will reach a wider audience?

    social.msdn.microsoft.com/.../threads

  • Anyone know how to trace a hanging jdbc connection within Eclipse 3.7.1 (Indigo) using jboss tools 3.3.0 M4 using sqljdbc4? Other jdbc URL's work (eg. IFMX).

    TIA,

    Henry

  • @freemarket (Henry)

    Try posting your question on the forums to reach a broader audience.

    social.msdn.microsoft.com/.../threads

  • Kindly check this link for my question

    stackoverflow.com/.../getting-connection-reset-by-peer-exception-toplink.

    The problem is why i am getting this only for first time and then again things starts work normally. No Reset peer exception after second time.

    Thanks

  • Hi friends

       I M Getting Error while creating the connection with Microsoft Sql server 2008 R2. In Place of Driver Jar ,i useing " jtds-1.2.4.jar " but i can't able to create connection

    Error is  = Connection can not be created with the metadata using the given metadata properties

    Please help me

Page 5 of 6 (77 items) «23456