Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7105007

Microsoft & jTDS JDBC driver broken after update to 1.6.0_29

XMLWordPrintable

    • x86
    • solaris_8, windows_xp, windows_2008, windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_29"
      Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Microsoft JDBC Driver 2.0 / 3.0 / 4.0 CTP 3
      SQL Server 2008R2

      A DESCRIPTION OF THE PROBLEM :
      Creating a JDBC connection through Microsoft JDBC Driver 2.0, 3.0, 4.0 CTP 3, or jTDS 1.2.5 driver to a Microsoft SQL server 2008R2 database using JDK 1.6.0_29 results in an indefinite wait for a connection. This worked fine on all previous versions from 1.6.0_27.

      Interrupting the thread does not work, it has to be stopped.

      REGRESSION. Last worked in version 6u26

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run supported source with one of the mentioned Microsoft SQL Server drivers.
      With version 1.6.0_29 this program will not terminate. With any other JVM version this will create a usable connection.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
        To see a line in console "Connected to database:"
      ACTUAL -
      None, program will not terminate, and needs to be stopped forcibly.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Stakctrace at the moment of thread stop:

          at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.6.0_29]
          at java.net.SocketInputStream.read(Unknown Source) ~[na:1.6.0_29]
          at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1647) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:3694) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:5026) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:4978) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(SQLServerConnection.java:1441) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(SQLServerConnection.java:1446) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1907) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1893) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1045) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:817) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700) ~[jdbc4-driver-3.0.jar:na]
          at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842) ~[jdbc4-driver-3.0.jar:na]
          at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.6.0_29]
          at java.sql.DriverManager.getConnection(Unknown Source) ~[na:1.6.0_29]

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.SQLException;
      import java.util.Properties;

      public class JdbcBug {

      public static void main(String[] args) throws SQLException {
      Properties connectionProps = new Properties();
      connectionProps.put("user", "my_username");
      connectionProps.put("password", "my_password");

      Connection conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433",
      connectionProps);
      System.out.println("Connected to database: " + conn);
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Revert to Java 1.6.0_27 or earlier version, or upgrade to 1.7.0_01. Or switch Microsoft database server. SQL Server 2008 , 2005, 2000 all work.
      From http://stackoverflow.com/questions/7841411/driver-getconnection-hangs-using-sqlserver-driver-and-java-1-6-0-29/

          * OS: Tested on both redhat 6.1 and Windows 2008
          * Driver: MS SQL Server JDBC Driver version 3.0.1301.101
          * Java Versions: 1.6.0_26 and 1.6.0_29

          Windows 7 x64, JDK 1.6.0_29, SQL Express 2008 R2 (10.50.1790), using
          sqljdbc4.jar, and it hangs on getConnection.

          Reproduced with SQL server 2008R2. SQL 2005 & 2008 work normally

      VERY IMPORTANT HERE:

          Works on 7.1, but not on 6u29.

            wetmore Bradford Wetmore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: