CREATE TABLE android_metadata failed ; Failed to setLocale() when constructing, closing the database E/Database ; net.sqlcipher.database.SQLiteException: file is encrypted or is not a database


#1

I have been able to successfully encrypt decrypt multiple databases. But one such database always return with this exception whenever i try to do a getReadableDatabase(password) or getWritableDatabase(password). I can confirm that database has already been created in SDCard.

06-01 11:34:44.417: I/Database(2490): sqlite returned: error code = 26, msg = file is encrypted or is not a database
06-01 11:34:44.417: E/Database(2490): CREATE TABLE android_metadata failed
06-01 11:34:44.437: E/Database(2490): Failed to setLocale() when constructing, closing the database
06-01 11:34:44.437: E/Database(2490): net.sqlcipher.database.SQLiteException: file is encrypted or is not a database


#2

Hi @AVD,

Are you able to write a test that reproduces the error within the SQLCipher for Android test suite?


#3

Although I have not written the test case, I am extending the same base class of type SQLIteOpenHelper in other two classes which are working fine. Somehow the third database (not working as mentioned in the question) is changing the password on its own ?


#4

Can you provide more details on this? To be clear, changing the password by itself (without your control) is not a feature of SQLCipher so I feel as if something else is at play within your application.


#5

Yes my bad. Threading issue. Overlooked. Resolved. :relaxed:


#6

@AVD - we are glad to hear that your issue is resolved. Take care!