Java 未找到驱动程序异常。我已经将derby.jar文件添加到库中,但它仍然显示了一个错误 只有代码!问题是什么?请注意,代码(如图所示)由于缺少“.1)而无法编译。为了更快获得更好的帮助,请发布一个(最小、完整、可验证的示例)。2)始终复制/粘贴错误或异常输出
未找到驱动程序异常。我已经将derby.jar文件添加到库中,但它仍然显示了一个错误Java 未找到驱动程序异常。我已经将derby.jar文件添加到库中,但它仍然显示了一个错误 只有代码!问题是什么?请注意,代码(如图所示)由于缺少“.1)而无法编译。为了更快获得更好的帮助,请发布一个(最小、完整、可验证的示例)。2)始终复制/粘贴错误或异常输出,java,database,swing,driver,Java,Database,Swing,Driver,未找到驱动程序异常。我已经将derby.jar文件添加到库中,但它仍然显示了一个错误 只有代码!问题是什么?请注意,代码(如图所示)由于缺少“.1)而无法编译。为了更快获得更好的帮助,请发布一个(最小、完整、可验证的示例)。2)始终复制/粘贴错误或异常输出。catch(SQLException e){}请注意.catch(exception ex){}..应该是。catch(exception ex){ex.printStackTrace();}.. private void jButton
只有代码!问题是什么?请注意,代码(如图所示)由于缺少
“
.1)而无法编译。为了更快获得更好的帮助,请发布一个(最小、完整、可验证的示例)。2)始终复制/粘贴错误或异常输出。catch(SQLException e){}
请注意.catch(exception ex){}..
应该是。catch(exception ex){ex.printStackTrace();}..
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)
{
}
}