我正在尝试使用 UCanAccess 更新 MS Access 数据库中的记录,但是当我尝试执行此操作时收到此消息:
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.5 java.lang.NoSuchMethodError: com.healthmarketscience.jackcess.Table.isAllowAutoNumberInsert()Z
代码:
public void saveBookInfo(){
try {
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection connectDb = DriverManager.getConnection("jdbc:ucanaccess://books.mdb");
String sql = "UPDATE bookInfo SET bookName=?, companyName=?, bossName=?, bossPosition=?, developerName=?, developerCompanyName=? WHERE bookId=?";
PreparedStatement pstmt = connectDb.prepareStatement(sql2);
pstmt.setString(1, jTextField2.getText());
pstmt.setString(2, jTextField3.getText());
pstmt.setString(3, jTextField4.getText());
pstmt.setString(4, jTextField5.getText());
pstmt.setString(5, jTextField6.getText());
pstmt.setString(6, jTextField7.getText());
pstmt.setInt(7, currentBookId);
pstmt.executeUpdate();
System.out.println("\nSuccess!");
closeSC(pstmt, connectDb);
} catch (Exception ex) {
System.out.println("\nException (saveBookInfo): " + ex);
}
}
有谁知道问题是什么?
(删除查询工作正常)