简体   繁体   English

eclipse说它正在使用JRE 1.7,即使它正在使用1.6

[英]eclipse says it's using JRE 1.7 even though it's using 1.6

I'm trying to build a simple jdbc sql example. 我正在尝试构建一个简单的jdbc sql示例。 it's 1 class. 这是一堂课。 I have both jdbc driver jars referenced it's runtime is JavaSE-1.6. 我引用了两个jdbc驱动程序jar,其运行时为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. 2013年12月20日,上午9:50:53 com.microsoft.sqlserver.jdbc.SQLServerConnection严重:此驱动程序不支持Java运行时环境(JRE)版本1.7。 Use the sqljdbc4.jar class library, which provides support for JDBC 4.0. 使用sqljdbc4.jar类库,该库提供对JDBC 4.0的支持。 Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. 线程“主”中的异常java.lang.UnsupportedOperationException:该驱动程序不支持Java运行时环境(JRE)1.7版。 Use the sqljdbc4.jar class library, which provides support for JDBC 4.0. 使用sqljdbc4.jar类库,该库提供对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) 在com.microsoft.sqlserver.jdbc.SQLServerConnection。(SQLServerConnection.java:304)在com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)在java.sql.DriverManager.getConnection(未知源)在sqldriver.doConnection(sqldriver.java:23)上的java.sql.DriverManager.getConnection(未知源)sqldriver.main(sqldriver.java:59)上的java.sql.DriverManager.getConnection(未知源)

Everything else has stayed the same. 其他一切都保持不变。 I tried restarting, unstalling/reinstalling, creating a new project, trying different JRE's nothing. 我尝试重新启动,卸载/重新安装,创建新项目,尝试使用其他JRE。
Is there something I'm missing here? 我在这里想念什么吗? something else I can try? 还有其他我可以尝试的东西吗?

never mind! 没关系! I got it working again by removing one of the jars. 我通过移除其中一个罐子使其再次工作。 The thing is, I had them both in there and it was working just fine before :P Mysterious 关键是,我俩都在里面,并且:P之前工作还不错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM