[英]class not found exception for com.mysql.jdbc.Driver
我知道這個問題有很多線程,但是這些解決方案都無法解決我的問題。 我已將必要的.jar文件添加到WEB-INF-lib文件夾中,但仍然收到錯誤消息。 我嘗試將.jar文件直接添加到生成路徑,但仍然遇到相同的錯誤。 誰能幫我這個忙! 我一直在處理這個問題已有兩天了,但無濟於事。
這是我的代碼:
<%@ 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");
}
%>
您的MySQL驅動程序類的軟件包名稱錯誤。 從
com.mySQL.jdbc.Driver
至
com.mysql.jdbc.Driver
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.