SqlJet トランザクションの使用中にデータベースにアクセスしようとしていますが、常にこのエラーが発生します
org.tmatesoft.sqljet.core.SqlJetException: MISUSE: error code is MISUSE
これが私のコードです:
SqlJetDb db = null;
try {
File dbFile = new File(Configuration.DATABASE_NAME);
db = SqlJetDb.open(dbFile, true);
db.getOptions().setAutovacuum(true);
db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
ISqlJetTable table = db.getTable("customers");
ISqlJetCursor cursor = table.order(table.getPrimaryKeyIndexName());
if (!cursor.eof()) {
do {
getInitData(cursor);
} while (cursor.next());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
db.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
問題の何が問題なのか誰にもわかりませんか?このリストのせいで、実際のライブラリの使い方は不適切でしたが、調べてみたところ、特に問題はありませんでした。 http://grepcode.com/file/repo1.maven.org/maven2/org.tmatesoft.sqljet/sqljet/1.0.2/org/tmatesoft/sqljet/core/SqlJetErrorCode.java#SqlJetErrorCode
ありがとう!