java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: ssentamu ddumba
Date: November 06, 2012 05:08AM

try {
Connection connection;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://localhost/javadatabase","root","");
System.out.println("Testing system");
String sql = "insert into test_data values(?,?,?,?)";
PreparedStatement pst = connection.prepareStatement(sql);
System.out.println("Testing two");

pst.setString(1,txt_fnum.getText());
pst.setString(2,txt_snum.getText());
pst.setString(3,txt_result.getText());
pst.executeUpdate();
} catch(Exception e){
System.err.println(e);
System.exit(1);
}

When I run the code above it gives me an error

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

What should I do to solve that error

Options: ReplyQuote


Subject
Written By
Posted
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
November 06, 2012 05:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.