SQLite 数据库被锁定?

SQLite database is locked?

我刚刚尝试将行添加到 SQLite 数据库中,文本部分包含“/”字符。

我是这样连接的:

private SQLiteDatabase db;

this.db = this.getWritableDatabase();


    db.beginTransaction();

    ..............................
    insertion stuffs
    ..............................

    db.setTransactionSuccessful();
    db.endTransaction();

插入之后,当我尝试插入新行时,应用程序崩溃并在 logcat 上给我这个错误:

08-24 19:01:09.477  27064-27064/? E/SQLiteLog﹕ (10) POSIX Error : 11 SQLite Error : 3850
08-24 19:01:09.477  27064-27064/? E/SQLiteLog﹕ (5) database is locked
Process: .MyService, PID: 17827
android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode

是斜杠字符还是什么?它在插入一行之前运行良好,还是我的 table 已损坏?

我想你忘了 close the connection to database, and invoke the method endTransaction()