I'm trying to build a simple jdbc sql example. it's 1 class. I have both jdbc driver jars referenced it's runtime is JavaSE-1.6. It connects to a database I already have setup using this code...
// Load the JDBC driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
// Create a connection to the database
connection = DriverManager
.getConnection("jdbc:sqlserver://localhost:1433;database=AboardTestDB;integratedSecurity=true");
System.out.println("Connected DB successfully");
// STEP 4: Execute a query
// writes the tables in local and not on GANESHN1\SQLSERVER2008
System.out.println("Creating table in given database...");
Statement stmt = connection.createStatement();
And the thing is it worked before. It worked beautifully. But a colleague of mine was having trouble with it. so I removed a jar to get the same error as him. but when I put it back it gave me this error message (again)
Dec 20, 2013 9:50:53 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.(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:23) at sqldriver.main(sqldriver.java:59)
Everything else has stayed the same. I tried restarting, unstalling/reinstalling, creating a new project, trying different JRE's nothing.
Is there something I'm missing here? something else I can try?
sqljdbc4.jaron your classpath, even on Java 6! - Mark Rotteveel