title: SQLiteException: file is not a database while upgrading sqlcipher version from 3 to 4
body: <p>I have integrated sqlcipher in our project a long time ago. Due to some security issue, we have to upgrade the version of sqlcipher. I have gone through this below links</p>
  
  <ol>
  <li><a href="https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652" rel="nofollow noreferrer">https://discuss.zetetic.net/t/migrating-from-sqlcipher-3-5-1-to-4-1-3-in-android/3652</a></li>
  <li><a href="https://discuss.zetetic.net/t/upgrading-sqlcipher-for-android-from-3-to-4/3580" rel="nofollow noreferrer">https://discuss.zetetic.net/t/upgrading-sqlcipher-for-android-from-3-to-4/3580</a></li>
  </ol>
  
  <p>but I don't know where to add that code. How do I integrate their code with mine.</p>
  
  <p>This is my Logcat</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.axis.leadsloans, PID: 8798
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.axis.leadsloans/com.axis.leadsloans.nnmnu}: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2928)
  Caused by: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
  </code></pre>
  
  <p>This is my database related code.</p>
  
  <pre><code>public class CRMDB {
      private SQLiteHelper sqLiteHelper;
      public SQLiteDatabase sqLiteDatabase;
      private Context context;
      .
      .
      .
  
      public CRMDB(Context c) {
          context = c;
          String s = "";
          SQLiteDatabase.loadLibs(c);
          SharedPreferences prefs = c.getSharedPreferences(Constants.PREFERENCE_NAME, Activity.MODE_PRIVATE);
          empid = prefs.getString("empid", "");
      }
  
  
      public CRMDB openToWrite() throws SQLiteFullException {
          sqLiteHelper = new SQLiteHelper(context, MYDATABASE_NAME + "_" + empid + ".db", null, MYDATABASE_VERSION);
          //App get crash on this line
          sqLiteDatabase = sqLiteHelper.getWritableDatabase("password");
          return this;
      }
  
  
      public CRMDB openToRead() throws SQLiteFullException {
          sqLiteHelper = new SQLiteHelper(context, MYDATABASE_NAME + "_" + empid + ".db", null, MYDATABASE_VERSION);
          sqLiteDatabase = sqLiteHelper.getReadableDatabase("password");
          return this;
      }
  
  
      public long insertData(String tablename, ContentValues contentvalue) {
          return sqLiteDatabase.insert(tablename, null, contentvalue);
      }
  
      public Cursor getData(String query) {
          Cursor c = sqLiteDatabase.rawQuery(query, null);
          return c;
      }
  
      public long updateData(String tablename, ContentValues contentvalue, String where, String whereArgs[]) {
          return sqLiteDatabase.update(tablename, contentvalue, where, whereArgs);
      }
  
      public class SQLiteHelper extends SQLiteOpenHelper {
  
          public SQLiteHelper(Context context, String name, CursorFactory factory, int version) {
              super(context, name, factory, version);
  
          }
  
          @Override
          public void onCreate(SQLiteDatabase db) {
              db.execSQL(tb_task_createtable);
              db.execSQL(tb_calls_createtable);
              db.execSQL(tb_messages_table);
          }
  
          @Override
          public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  
          }
      }
  }
  </code></pre>
  
  <p>Please help me to understand this.</p>