[英]class not found exception for com.mysql.jdbc.Driver
I know there are many many threads on this problem but none of these solutions fix my issue. 我知道这个问题有很多线程,但是这些解决方案都无法解决我的问题。 I have added the necessary .jar file to the WEB-INF-lib folder and i still get the error.
我已将必要的.jar文件添加到WEB-INF-lib文件夹中,但仍然收到错误消息。 I tried directly adding the .jar file to the build path, and i still get the same error.
我尝试将.jar文件直接添加到生成路径,但仍然遇到相同的错误。 Can anyone help me out on this!
谁能帮我这个忙! I've been playing around with this issue for a couple days now to no avail.
我一直在处理这个问题已有两天了,但无济于事。
Here's my code: 这是我的代码:
<%@ page import = "java.sql.*" %><%@ page import = "java.io.*" %><%@ page import = "com.mysql.*" %><?xml version ="1.0" ?>
<tours>
<%
Connection connection = null;
Statement staement = null;
ResultSet result = null;
try{
Class.forName("com.mySQL.jdbc.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/tours", "root", "root");
out.println("connected to database");
}
catch(SQLException e){
out.println("error connecting to database");
}
%> %>
You have wrong package name of MySQL driver class. 您的MySQL驱动程序类的软件包名称错误。 Change from
从
com.mySQL.jdbc.Driver
to 至
com.mysql.jdbc.Driver
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.