0
我知道有這個問題很多很多線程,但這些解決方案解決了我的問題。我已將必要的.jar文件添加到WEB-INF-lib文件夾中,並且仍然出現錯誤。我試着直接將.jar文件添加到構建路徑,並且仍然收到相同的錯誤。任何人都可以幫我解決這個問題!我一直在這個問題上玩了幾天,但無濟於事。類未發現異常的com.mysql.jdbc.Driver
這裏是我的代碼:
<%@ 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");
}
%>
謝謝你抓我粗心市值! – Potassiumrich