简体   繁体   English

异常:ClassNotFoundException:com.mysql.jdbc.Driver

[英]Exception: ClassNotFoundException: com.mysql.jdbc.Driver

I am doing a simple JSP program to connect with MySQL DB. 我正在做一个简单的JSP程序来连接MySQL DB。 But it's showing the Exception like this. 但是它显示了这样的异常。 I am using Java version 1.6 and MySQL -connector 5.1.20. 我正在使用Java版本1.6和MySQL连接器5.1.20。 I have placed this connector (.jar) file in lib/ext directory of JAVA_HOME. 我已将此连接器(.jar)文件放在JAVA_HOME的lib / ext目录中。 I have set the CLASSPATH also to the value upto connector (.JAR) file. 我也将CLASSPATH设置为upto连接器(.JAR)文件的值。 Still, I get the same Exception. 仍然,我得到同样的异常。

I have searched for this. 我已经搜索了。 I did all the things suggested by them. 我做了他们建议的所有事情。 But I didn't found any results. 但是我没有找到任何结果。

Please help me. 请帮我。

Place the connector jar in the TOMCAT_HOME/lib folder of your tomcat installation. 将连接器jar放置在tomcat安装的TOMCAT_HOME / lib文件夹中。 It should work. 它应该工作。

如果您使用的是Netbeans,则右键单击您的项目,选择“添加库”,然后选择MySQL JDBC驱动程序并保存。

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

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