使用intellij13中的jdbc连接器连接到mysql数据库

时间:2014-03-06 11:47:09

标签: java mysql jdbc intellij-idea

当我必须使用jdbc连接到mysql时,此代码行中出现错误:

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306
/server1","root","admin");

错误是:

C:\jdk\bin\java -Didea.launcher.port=7539 "-Didea.launcher.bin.path=C:\IntelliJ IDEA 
13.0.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\jdk\jre\lib\i18n.jar;C:\jdk\jre
\lib\jaws.jar;C:\jdk\jre\lib\rt.jar;C:\jdk\jre\lib\sunrsasign.jar;C:\Users\Kamyar
\Desktop\chatjava\untitled3\out\production\untitled3;C:\Users\Kamyar\Desktop\MYjdbc
\mysql-connector-java-5.1.6-bin.jar;C:\IntelliJ IDEA 13.0.2\lib\idea_rt.jar" 
com.intellij.rt.execution.application.AppMain ccc

java.lang.NoClassDefFoundError: java/sql/Savepoint
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at ccc.main(ccc.java:17)
at java.lang.reflect.Method.invoke(Native Method)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Exception in thread "main" 
Process finished with exit code 1

我该怎么做才能解决问题? 感谢...

0 个答案:

没有答案