# SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(\*) FROM sqlite\_schema;

**URL:** <https://discuss.zetetic.net/t/sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6391>\
**Category:** SQLCipher\
**Created:** [April 16, 2024, 5:00am UTC](https://discuss.zetetic.net/t/sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6391 "2024-04-16T05:00:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicky\_khurana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/vicky_khurana/32/2208_2.png) [@vicky\_khurana](https://discuss.zetetic.net/u/vicky_khurana)\
**Post date:** [April 16, 2024, 5:00am UTC](https://discuss.zetetic.net/t/sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6391/1 "2024-04-16T05:00:59Z")

</div>

Hello Team,

I am using **“implementation ‘net.zetetic:android-database-sqlcipher:3.5.9@aar’”** dependency in my application

Now i am shifting to

'implementation ‘net.zetetic:sqlcipher-android:4.5.6@aar’

'implementation ‘androidx.sqlite:sqlite:2.2.0’

But app is getting crashed on “getWritableDatabase()” code.  
I have checked password is getting correct in old and updated application.

DbHelper Code is below which extends SQLiteOpenHelper

```auto
private DbHelper(Context context) {
    super(context, databaseName, password, null, databaseVersion, 1, null, null, false);
}

```

```auto
public static synchronized SQLiteDatabase getDatabaseInstance(Context context) {

    mContext = context;
    try {

        if (instance == null) {
            instance = new DbHelper(context);
        }

        if (sqliteDatabase == null || !sqliteDatabase.isOpen()) {

            sqliteDatabase = instance.getWritableDatabase();
        }

        return sqliteDatabase;

    } catch (Exception e) {
        Logger.error(e.getMessage());
    }
    return null;
}

```

Error Message - **android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(\*) FROM sqlite\_schema;**

---

<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:** [April 16, 2024, 1:31pm UTC](https://discuss.zetetic.net/t/sqliteexception-file-is-not-a-database-code-26-while-compiling-select-count-from-sqlite-schema/6391/2 "2024-04-16T13:31:05Z")

</div>

Hi @vicky_khurana,

SQLCipher 4.x will not open SQLCipher 3.x database files by default. We have some guidance on the options available to address this here:

> [@Upgrading to SQLCipher 4](https://discuss.zetetic.net/t/upgrading-to-sqlcipher-4/3283):
>
> The recent release of [SQLCipher 4](https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/) introduces many new performance and security enhancements for applications that use SQLCipher for secure local data storage. However, the introduction of new default algorithms, increased KDF iterations and a larger page size means that SQLCipher 4 will not open older databases by default. This document provides guidance on the upgrade options available to applications that have previously integrated SQLCipher versions 1 through 3. Option 1: Database File Migr…
