重複の可能性:
com.mysql.jdbc.Driver を読み込めません
こんにちは、テーブルを更新しようとしていますが、接続が失敗し続けます。以下は私が持っているコードです:
try {
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver).newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=convertToNull","root","P@typd79");
Statement stmt = con.createStatement();
String query = "INSERT INTO project_one.personal_info(ssn,name,street,city,state,zip,class,degree,s,imm) VALUES"
+ "(" + social + "," + Name + "," + Address + "," + City + "," + State + "," + Zip
+ "," + Year + "," + Degree + "," + HS + "," + IMM + ")";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "New student added successfully");
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"Data not saved: " + e,"Error",JOptionPane.ERROR_MESSAGE);
}
}
接続名とドライバーは正しいのですが、次のエラーが表示されますjava.lang.classnotfound.exeption:com.mysql.jdbc.Driver.
私が見逃しているのは何ですか?