[英]ClassNotFoundException 'com.mysql.jdbc.Driver'
I got this error when I use Class.forName[...]
. 使用Class.forName[...]
时出现此错误。 I used the JConnector MSI Installer ( http://dev.mysql.com/downloads/connector/j/5.1.html ) so I got no ZIP file to add to my build path or I don't know where the installer put it. 我使用了JConnector MSI安装程序( http://dev.mysql.com/downloads/connector/j/5.1.html ),所以我没有将ZIP文件添加到构建路径中,或者我不知道安装程序将它放在哪里。
Any ideas? 有任何想法吗?
Try to insert this: 尝试插入此:
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
before getting the JDBC Connection. 在获得JDBC连接之前。
Other option : 其他选择:
1: Download the mysql-connector-java.jar 1:下载mysql-connector-java.jar
2: You need to drop JAR in /WEB-INF/lib folder. 2:您需要将JAR放在/ WEB-INF / lib文件夹中。
3: properties of project->build path->add JAR and selected the JAR above. 3:项目->构建路径->添加JAR的属性并选择上面的JAR。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.