Android Jelly bean数据库被锁定(代码5)

时间:2012-09-19 09:36:29

标签: android database sqlite android-4.2-jelly-bean

我的ListActivity中的数据库被锁定(代码5),代码在其他版本的模拟器中工作但在4.1版本的模拟器中失败

  

E / SQLiteLog(2132):( 5)数据库被锁定   E / SQLiteDatabase(2132):无法打开数据库'/data/data/id.online.mydroid/databases/geo.db'。   E / SQLiteDatabase(2132):android.database.sqlite.SQLiteDatabaseLockedException:数据库被锁定(代码5):,编译时:PRAGMA   al_mode   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.nativePrepareStatement(本机方法)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:627)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:313)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:287)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)   E / SQLiteDatabase(2132):在android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:804)   E / SQLiteDatabase(2132):在android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)   E / SQLiteDatabase(2132):在android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)   E / SQLiteDatabase(2132):在id.online.mydroid.myDB.openForRead(myDB.java:158)   E / SQLiteDatabase(2132):at id.online.mydroid.mydroid.refreshCount(mydroid.java:207)   E / SQLiteDatabase(2132):at id.online.mydroid.mydroid.onResume(mydroid.java:525)   块引用

1 个答案:

答案 0 :(得分:8)

beginTransaction持有锁