Reputation: 591
I've installed both java 6 and 7 and using eclipse to write a simple jdbc application. I have both sqljdbc4.jar and sqljdbc.jar in the lib folder. I'm getting this message...
Dec 18, 2013 9:29:51 AM com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at sqldriver.doConnection(sqldriver.java:27)
at sqldriver.main(sqldriver.java:12)
If I'm suppose to be using 1.6 how would I go about doing that?
Upvotes: 3
Views: 6781
Reputation: 591
I got it.
I needed to change the Run/Debug Settings > Edit > Execution environment
And there I go.
It's not a permanent fix but it will do for now.
Upvotes: 1
Reputation: 2083
I had a similar issue when I tried to import data from SQL Server into my Solr index (solr v1.4.0 on a Windows Server 2012 R2 machine). To fix the issue I deleted sqljdbc.jar from the solr lib directory and added sqljdbc4.jar to the same directory.
Upvotes: 0
Reputation: 577
Try this example. It's easier and you don't need to add the sqljdbc jars.
Upvotes: 1
Reputation: 108971
You need to remove sqljdbc.jar
from the class and build path and only use sqljdbc4.jar
(which is for Java 6 and higher).
Upvotes: 10
Reputation: 5531
Right click on your project --> properties and then Java compiler and then select the java version you need
Upvotes: 2