SQL Server JDBC Exception

99封情书 提交于 2019-12-12 10:51:29

问题


When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar.

[javadoc] java.lang.UnsupportedOperationException: 
    Java Runtime Environment (JRE) version 1.6 is not supported by this driver.
    Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

回答1:


Refer to this link: http://msdn.microsoft.com/en-us/library/ms378526.aspx

"sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0 or later."

So if you aren't using a JDK 1.6 or later when compiling, you will get an error when using sqljdbc4.jar.

If you are using JDK 1.5 or earlier, then you need to be using the sqljdbc.jar, which you can get from here.

Also, one tip with ANT is that you can use "ant -verbose" to help determine which libaries it's finding on the classpath to make sure it's using the sqljdbc JAR you expect. Also, make sure to confirm which version of the JDK you are compiling with. You can set the JAVA_HOME environment variable to point to a different JDK to compile with.



来源:https://stackoverflow.com/questions/2212037/sql-server-jdbc-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!