-2
private void jAddActionPerformed(java.awt.event.ActionEvent evt) {                                     
    try {
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        String url="jdbc:derby://localhost:1527/One";
        String username = "one1";
        String password = "matt123";

        Connection con = DriverManager.getConnection(url,username,password);
        String Query = " INSERT INTO ONE (NAME ,SURNAME) ('"+jName.getText()+"','"+jModel.getText()+"')";
    } catch(SQLException ex) {
        JOptionPane.showMessageDialog(null, ex.toString());
    }   // TODO add your handling code here:
}   
Mike
  • 3,186
  • 3
  • 26
  • 32
  • 3
    first write your question in a proper way , second add the libraries to your classpath before starting the java application – AntJavaDev Jul 01 '16 at 16:25

2 Answers2

3

The problem is MySQL driver is missing in your project's classpath.

https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar copy and paste the jar file in your classpath. If it is a web-application copy and paste the jar file in WEB-INF/lib/ directory.

Govinda Sakhare
  • 5,009
  • 6
  • 33
  • 74
0

It is what it is; the class com.mysql.jdbc.Driver can't be found by your classloader, meaning you probably forgot to include the JAR in your classpath.

nasukkin
  • 2,460
  • 1
  • 12
  • 19