# net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(\*) from sqlite\_master

**URL:** <https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644>\
**Category:** Issues\
**Created:** [May 9, 2019, 7:38am UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644 "2019-05-09T07:38:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gupta126](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@gupta126](https://discuss.zetetic.net/u/gupta126)\
**Post date:** [May 9, 2019, 7:38am UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644/1 "2019-05-09T07:38:17Z")

</div>

Dear Team,

Currently, I am using v3.5.7 ‘net.zetetic:android-database-sqlcipher:3.5.7@aar’,  
and when we update to the latest v4.13 ‘net.zetetic:android-database-sqlcipher:4.1.3@aar’

we are getting below exception while opening database through ContentProvider.  
I have verified we are passing same database password.

I have test with [Test Suite](https://github.com/sqlcipher/sqlcipher-android-tests)  
where i have checkout [Test suit with Library version3.5.8](https://github.com/sqlcipher/sqlcipher-android-tests/tree/86318cc315836edf5a064de0e35dc5de21e149b2) and tried to update it with latest version 4.1.3  
Here I have observed that it fails 7 test cases  
for reference i have attached screenshot

 ![device-2019-05-09-131319](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/0/0db78b598bbb718fb817ea7b20d34165c04cd392.png)

**Below is excepion:**  
net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(\*) from sqlite\_master;

```
Unable to create application com.qualys.android.agent.MainApplication: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
		android.app.ActivityThread.handleBindApplication(ActivityThread.java:5447)
		android.app.ActivityThread.-wrap2(ActivityThread.java)
		android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
		android.os.Handler.dispatchMessage(Handler.java:102)
		android.os.Looper.loop(Looper.java:154)
		android.app.ActivityThread.main(ActivityThread.java:6165)
		java.lang.reflect.Method.invoke(Native Method)
		com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
		com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: 
file is not a database: , while compiling: select count(*) from sqlite_master;
		net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
		net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
		net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
		net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
		net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
		net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
		net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:2012)
		net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1898)
		net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2647)
		net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2577)
		net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1243)
		net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1318)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:166)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:135)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:131)
```

---

<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:** [May 9, 2019, 1:04pm UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644/2 "2019-05-09T13:04:54Z")

</div>

Hi @gupta126

You should also update the test suite library from master, it has been updated to work with SQLCipher for Android 4.1.3.

---

<div class="post-metadata">

**Author:** ![gupta126](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@gupta126](https://discuss.zetetic.net/u/gupta126)\
**Post date:** [May 9, 2019, 1:26pm UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644/3 "2019-05-09T13:26:18Z")

</div>

Hi @developernotes,

But while updating the library in our we are getting an exception.

---

<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:** [May 9, 2019, 1:44pm UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644/4 "2019-05-09T13:44:34Z")

</div>

Hi @gupta126

Your exception is likely due to the change in the library file format due to a large number of security improvements. SQLCipher for Android 4.1.3 includes the major version [update to SQLCipher Core 4.0](https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/), please review the upgrade documentation to SQLCipher 4 series [here](https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283).

Would you try the upgrade approach and let us know your results?

---

<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:** [September 27, 2019, 12:16pm UTC](https://discuss.zetetic.net/t/net-sqlcipher-database-sqliteexception-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/3644/5 "2019-09-27T12:16:08Z")

</div>

A post was split to a new topic: [Migrating Android Application from SQLCipher 3 to 4](https://discuss.zetetic.net/t/migrating-android-application-from-sqlcipher-3-to-4/3943)
