驱动程序未找到异常。我已将derby.jar文件添加到图书馆但仍显示错误

时间:2014-08-20 21:49:10

标签: java database swing driver

  private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            String textFieldValue = jTextField1.getText();
            String textFieldValue1 = jTextField2.getText();
            String textFieldValue2 = jTextField3.getText();
            String textFieldValue3 = jTextField4.getText();
            String textFieldValue5 = jTextArea1.getText();
            String textFieldValue4 = jTextField5.getText();
                Connection con=null;
                Statement stmt=null;

            try{
              /* amrita is user and amritha ipassword*/con=DriverManager.getConnection("jdbc:derby://localhost:1527//contact;create=true","amrita,"amritha");
              stmt=con.createStatement();
            } catch (SQLException ex) {
                Logger.getLogger(newcontact.class.getName()).log(Level.SEVERE, null, ex);
            }

                String name = textFieldValue;
                String lname = textFieldValue1;   /* fields used in jframe form*/
                String phone = textFieldValue2;
                String home = textFieldValue3;
                String email = textFieldValue4;
                String addr = textFieldValue5;


                String insert = "INSERT INTO AMRITA.ADRESSBOOKTABLE VALUES ('" + name + ","+lname+","+phone+","+home+","+addr+","+email+"')";

            try {
                stmt.executeUpdate(name);
                stmt.executeUpdate(lname);
                stmt.executeUpdate(phone);
                stmt.executeUpdate(home);
                stmt.executeUpdate(addr);
                stmt.executeUpdate(email);// TODO add your handling code here:
        }                                        
         catch(SQLException e)
         {

         }
 }

0 个答案:

没有答案