sqlbrite-dao icon indicating copy to clipboard operation
sqlbrite-dao copied to clipboard

SQLiteDatabaseLockedException: database is locked (code 5)

Open praveen2gemini opened this issue 7 years ago • 2 comments

@sockeqwe Can we have any suggestion on this issue? It'd helpful to identify the loop hole. SqlBrite Version is sqlDaoVer = '0.4.1'

My crash report from Android Monitor: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782) at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788) at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1472) at com.squareup.sqlbrite.BriteDatabase.insert(BriteDatabase.java:351) at com.hannesdorfmann.sqlbrite.dao.Dao.insert(Dao.java:243) This report takes me to Dao.java code and following line:

protected Observable<Long> insert (final String table, final ContentValues contentValues, final int conflictAlgorithm) { return Observable.just(db.insert(table, contentValues, conflictAlgorithm)); }

praveen2gemini avatar May 11 '17 09:05 praveen2gemini

I'm not sure if this is related to this library.

  • Do you instantiate mulitple DaoManager?
  • Do you close all transactions?

sockeqwe avatar May 11 '17 13:05 sockeqwe

No we have only one DaoManager. We're using Dagger2 It will be singleton. Transactions not in our control.

praveen2gemini avatar May 12 '17 11:05 praveen2gemini