www.un.org/Depts/DGACM/index_french.htm
public static void insertIntoDatabase(String code,String name,String temp,String hum,String del) {
Connection con = null;
ResultSet rs = null;
String url = "jdbc:mysql://localhost:3306/test";
String user = "root";
String password = "";
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, user, password);
rs = con.prepareStatement("CREATE TABLE IF NOT EXISTS AiportDetails(code VARCHAR(50) PRIMARY KEY, " +
"name VARCHAR(50), temp VARCHAR(50), hum VARCHAR(50), del VARCHAR(50)) ENGINE=InnoDB;").executeQuery();
rs = con.prepareStatement("INSERT INTO AirportDetails(code,name,temp,hum,del) VALUES("+code+","+
name+","+temp+","+hum+","+del+");").executeQuery();
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
try {
if (rs != null) {
rs.close();
}
if (con != null) {
con.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
I am getting the following error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
NOTE Some common corrections I found online were:
1. The driver is not in the /WEB-INF/lib folder.
2. The url is wrong.
I dont think this is the case with my code.
Thank you.