Preview the new JDBC 4.2 for SQL Server Driver


Greetings SQL Server developers and users,

Today we are pleased to announce availability of the Community Technology Preview (CTP) of the Microsoft JDBC 4.2 Driver for SQL Server!  This driver now supports the Java Development Kit 8 (JDK8), bulk load, better XA transaction handling and full compliance with JDBC 4.2 specification.

To read the full release communication, you can click here.

JDBC Driver Version

JRE Versions

JDBC API Version

4.2

1.5, 1.6, 1.7m 1.8

3.0, 4.0

For further details, you can click here.

You can also download it from here.

We are working next on some more exciting features. Stay tuned for future announcements.

Luiz Santos (lfsantos@microsoft.com)


Comments (7)

  1. Roxana Danger says:

    I have tried to use JDBC Driver Version 4.2 in Ubuntu 14.04 and Oracle jdk 1.8 but I get an error of Unsatisfied link error, it seems the driver is searching for sqljdbc_auth.so, and only sqljdbc_auth.dll is provided.

    Any suggestion is highly appreciated.

  2. Augustin D. Lee says:

    I have tried to use JDBC Driver Version 4.2.

    But it does not work parameters pass to MS-SQL.

    SELECT     COUNT(*) MARKING_STUDENT_COUNT    

     FROM         ezi_study

         WHERE     LECTUREINFORM = 'tutor01'  

        AND NOT(DATEADD(DAY, 1, CAST(LECTUREEND AS DATETIME)) < DATEADD(DAY, 1, CAST('2015-08-19' AS DATETIME))    

          AND DATEADD(DAY, 7, CAST(LECTUREEND AS DATETIME)) < DATEADD(DAY, 1, CAST('2015-08-19' AS DATETIME)))

           AND NOT(DATEADD(DAY, 1, CAST(LECTUREEND AS DATETIME)) > DATEADD(DAY, 7, CAST('2015-08-19' AS DATETIME))

              AND DATEADD(DAY, 7, CAST(LECTUREEND AS DATETIME)) > DATEADD(DAY, 7, CAST('2015-08-19' AS DATETIME)))

    IT WORK ON MANAMENT STUIO.

    BUT

    SELECT     COUNT(*) MARKING_STUDENT_COUNT    

     FROM         ezi_study

         WHERE     LECTUREINFORM = ?  

        AND NOT(DATEADD(DAY, 1, CAST(LECTUREEND AS DATETIME)) < DATEADD(DAY, 1, CAST(? AS DATETIME))    

          AND DATEADD(DAY, 7, CAST(LECTUREEND AS DATETIME)) < DATEADD(DAY, 1, CAST(? AS DATETIME)))

           AND NOT(DATEADD(DAY, 1, CAST(LECTUREEND AS DATETIME)) > DATEADD(DAY, 7, CAST(? AS DATETIME))

              AND DATEADD(DAY, 7, CAST(LECTUREEND AS DATETIME)) > DATEADD(DAY, 7, CAST(? AS DATETIME)))

    AND parameters 'tutor01' '', '2015-08-19', '2015-08-19', '2015-08-19', '2015-08-19' DOES NOT WORK! GRAMMER PROBLEM MESSAGE ...?!

    IT seems to be a bug on MS-SQL JDBC Driver 4.2 preview.

  3. Pawel1986 says:

    By the way ....

    Trying to integrate SQL Server with Java application running on Glassfish turned out to be a complete failure. It is working great with MySQL but trying to connect it with JDBC (sql4jdbc.jar) to SQL Server is literally a nightmare!

    Here is very detail description of the problem:

    stackoverflow.com/.../invalidkeyspecexception-on-deploying-ear-file-containing-entitybeans-and-using

    ... But in a short, all I get from this "Integration exercise" is this entry in a Glassfish log file:

    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Server key". ClientConnectionId:a3f21831-fbc0-491c-9691-2b28500d7d2b

    Error Code: 0. Please see server.log for more details.

    ... Apparently caused by: Caused by: java.security.spec.InvalidKeySpecException: Unknown KeySpec type: java.security.spec.ECPublicKeySpec

    No idea what to do.

  4. kanupoju says:

    Even the latest JDBC driver V 4.2 is not supporting the CBC Protection. Database connections are refused when CBC Protection is turned ON as the JDBC drivers are not supporting. Could someone please let us know if this is even on the roadmap of MSFT to resolve this defect? We have been awaiting since V 3.8 - 3.9 - 4.0 - 4.1 and now 4.2. But none of the versions has the fix for this defect.

  5. RAVI says:

    Microsoft JDBC Driver 4.2 for SQL Server does not work with JRE 1.7 :

    I get the following error:

    Caused by: java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver : Unsupported major.minor version 52.0 (unable to load class com.microsoft.sqlserver.jdbc.SQLServerDriver)

  6. ReplytoRavi says:

    RE: Microsoft JDBC Driver 4.2 for SQL Server does not work with JRE 1.7

    Correct.  It should not according to the System Requirements link

    msdn.microsoft.com/.../ms378422(v=sql.110).aspx

  7. John Lonergan says:

    Excited to see the BulkCopy support and it does speed up inserts, however there is an absence of useful documentation.

    Re msdn.microsoft.com/.../mt221490(v=sql.110).aspx

    This page is the only documentation I can find on the new MsSql JDBC 4.2 extension Bulk Copy support.

    A number of API’s are mentioned but none of these API’s carry documentation (javadoc) and the web page I mentioned doesn’t compensate for this lack of javadoc.

    We expect comprehensive api documentation and example code for the following API’s

    - ISQLServerBulkRecord

    - SQLServerBulkCopy

    - SQLServerBulkCSVFileRecord

    At the moment one has to guess what the parameters on api’s are or mean and have to use trial and error to work out how to encode data so it works on these api’s. Has the code had debug symbols stripped- if so why??

    The dev community expect to see the sort of quality api doc and example code that one would find in a good open source project.

    It would be great to have a complete example of ISQLServerBulkRecord including examples of configuring that api for each (all) of the Java datatypes (a la JDBC PreparedStatement interface) vs the SqlServer RDB data types, including appropriate precision and scale, and how to encode data (eg to hex strings or anything else). Currently the best documentation how to use it is by decompiling SQLServerBulkCSVFileRecord and that only helps me for the types used in that utility - not good.

    Looking at the internal implementation of SQLServerBulkCSVFileRecord (a derivative of ISQLServerBulkRecord ) it seems there’s a lot of implicit knowledge required to make this stuff work.

    For instance the precision field of TIMESTAMP values is overridden set to 35 / for DATE and TIME types it’s hard coded to 20 – why is this the case? and how would someone else attempting to write an implementation of ISQLServerBulkRecord know that the magic number 35 or 20 ought to be used?

    Re ISQLServerBulkRecord

    - How do I send a java.sql.Timestamp value to the db, scale and precision to the various db date/time types

    - How do I send data from java Array[Byte] to a binary column

    - What about a string to an nvarchar col vs a string to an nvarchar(max) column

    etc

Skip to main content