# 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

**URL:** <https://discuss.zetetic.net/t/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/597>\
**Category:** Issues\
**Created:** [June 1, 2015, 3:54pm UTC](https://discuss.zetetic.net/t/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/597 "2015-06-01T15:54:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AVD](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@AVD](https://discuss.zetetic.net/u/AVD)\
**Post date:** [June 1, 2015, 3:54pm UTC](https://discuss.zetetic.net/t/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/597/1 "2015-06-01T15:54:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [June 1, 2015, 7:21pm UTC](https://discuss.zetetic.net/t/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/597/2 "2015-06-01T19:21:08Z")

</div>

Hi @AVD,

Are you able to write a test that reproduces the error within the SQLCipher for Android [test suite](https://github.com/sqlcipher/sqlcipher-android-tests)?

---

<div class="post-metadata">

**Author:** ![AVD](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@AVD](https://discuss.zetetic.net/u/AVD)\
**Post date:** [June 2, 2015, 6:21pm UTC](https://discuss.zetetic.net/t/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/597/3 "2015-06-02T18:21:30Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [June 2, 2015, 6:50pm UTC](https://discuss.zetetic.net/t/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/597/4 "2015-06-02T18:50:20Z")

</div>

> [@AVD](#):
>
> Somehow the third database (not working as mentioned in the question) is changing the password on its own ?

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.

---

<div class="post-metadata">

**Author:** ![AVD](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@AVD](https://discuss.zetetic.net/u/AVD)\
**Post date:** [June 3, 2015, 9:00am UTC](https://discuss.zetetic.net/t/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/597/5 "2015-06-03T09:00:40Z")

</div>

Yes my bad. Threading issue. Overlooked. Resolved. 😌

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [June 3, 2015, 12:53pm UTC](https://discuss.zetetic.net/t/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/597/6 "2015-06-03T12:53:44Z")

</div>

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