1

I'm trying to update a record in MS Access database using UCanAccess, but I get this message when i try to do it:

net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.5 java.lang.NoSuchMethodError: com.healthmarketscience.jackcess.Table.isAllowAutoNumberInsert()Z

Code:

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);
    }
}

Does anyone know what the problem is?

(DELETE query works fine)

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

1

Answered by Gord Thompson:

"Verify that you are using Jackcess version 2.1.3 with your project. Note that "jackcess-2.1.3.jar" is available in the lib folder of the UCanAccess distribution."