locked
SQL Server JDBC Driver 2.0 - Appears to be compiled for Java 6 as opposed to Java 5 RRS feed

  • Question

  • The download site for the JDBC driver (http://www.microsoft.com/downloads/details.aspx?FamilyID=99b21b65-e98f-4a61-b811-19912601fdc9&displaylang=en) reports compatibility with Java 5.0 and higher, however while trying to use it in a Java 5.0 environment I get this exception:
    Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class com.microsoft.sqlserver.jdbc.SQLServerDriver)

    Looking further, the version number in SQLServerDriver is 1.6.

    Why is the JDBC driver compiled for Java 6 while stating compatibility with Java 5?  Is there a Java 5 version other than going down to the 1.2 driver?
    Monday, October 5, 2009 4:42 PM

Answers

  • Hi Craig,

    Thank you for your post. SQL Server JDBC Driver 2.0 is compatible with Java 5.0. The JDBC Driver version 2.0 includes 2 JAR class libraries in each installation package: sqljdbc.jar and sqljdbc4.jar  The sqljdbc.jar provides support for JDBC 3.0 and requires a JRE of version 5.0.  Please adjust your classpath accordingly to include this file. If you want to run your application with Java 6.0, please use sqljdbc4.jar.

    You can find more information in the System Requirements for the JDBC Driver information page here: http://msdn.microsoft.com/en-us/library/ms378422.aspx

    Thanks,
    Erin Hardiman


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, October 5, 2009 8:01 PM

All replies

  • Hi Craig,

    Thank you for your post. SQL Server JDBC Driver 2.0 is compatible with Java 5.0. The JDBC Driver version 2.0 includes 2 JAR class libraries in each installation package: sqljdbc.jar and sqljdbc4.jar  The sqljdbc.jar provides support for JDBC 3.0 and requires a JRE of version 5.0.  Please adjust your classpath accordingly to include this file. If you want to run your application with Java 6.0, please use sqljdbc4.jar.

    You can find more information in the System Requirements for the JDBC Driver information page here: http://msdn.microsoft.com/en-us/library/ms378422.aspx

    Thanks,
    Erin Hardiman


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, October 5, 2009 8:01 PM
  • Thank you!  I didn't realize I was using the wrong JAR.
    Monday, October 5, 2009 8:45 PM