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

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

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     try
     {
        Class<?> forName = Class.forName("com.mysql.jdbc.Driver");
      Connection conn =  DriverManager.getConnection("jdbc:mysql://localhost/krishna","krishna","krishna");
      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery("INSERT INTO APP.TRIAL_TABLE VALUES ('"+jTextField1.getText()+"','"+jTextField2.getText()+"','"+jTextField3.getText()+"','"+jTextField4.getText()+"'");


    }

catch (Exception e) { System.out.println(e); }

}   

public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new tryk().setVisible(true);
        }
    });
}

SHOWS ME FOLLOWING ERROR : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

View Answers

March 8, 2011 at 11:31 AM

Do you have mysql-connector-java-5.0.5.jar? If not then install it and set its path.









Related Tutorials/Questions & Answers:

Ads