sqlcipher/android-database-sqlcipher

Can not create writeable

thonguyen252 opened this issue · 1 comments

Can open a writeable database

Couldn't open a writeable database, but a readonly instead

Couldn't open my_db.db for writing (will try read-only):
net.sqlcipher.database.SQLiteDiskIOException: disk I/O error: COMMIT;
at net.sqlcipher.database.SQLiteDatabase.native_execSQL(Native Method)
at net.sqlcipher.database.SQLiteDatabase.execSQL(SQLiteDatabase.java:2439)
at net.sqlcipher.database.SQLiteDatabase.endTransaction(SQLiteDatabase.java:834)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:188)
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:241)
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:228)
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:224)
at org.greenrobot.greendao.database.DatabaseOpenHelper.getEncryptedWritableDb(DatabaseOpenHelper.java:134)

SQLCipher version: 4.5.0

SQLCipher for Android version: 4.5.0

Are you able to reproduce this issue within the SQLCipher for Android test suite? Not tried yet

I get this issue in the first launch - after installing the app, or after clearing data. I have to recall- mDbOpenHelper.getEncryptedWritableDb(dbPassword) for several times before be able to get a writable database. Or just in the next time I open the app, the issue is gone.

Hi @thonguyen252,

It appears you are using the greenDAO library, are you able to reproduce this behavior outside of greenDAO? A quick test would be to try creating a connection to the same database using the SQLCipher for Android library directly. Is the database file located in the databases directory of your application, or another writable location?