android数据库rekey抛出异常

时间:2015-06-09 06:55:41

标签: android database sqlite

    i have two database in my project 

    Database1 db1;
    db1.open();
    String newKey= "newKey";
    db1.rekey(currentKEy, newKey);
    db1.close();


    DataBase2 db2;
    db2.rekey(currentKEy, newKEy);

的logcat

Failed to setLocale() when constructing, closing the database
 net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
 net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2102)
net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1968)
 net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901)
 net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:944)
 net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107)
 com.acs.android.fwk.database.SQLiteOpenHelper.open(SQLiteOpenHelper.java:98)

对于DB1来说这是正常的,但对于DB2,它会抛出异常 在重新键入之前是否必须打开数据库....

1 个答案:

答案 0 :(得分:0)

SQLiteException: file is encrypted or is not a database

我遇到了这个问题。我的方案是输入错误的数据库密码。

我猜您使用Db1密码访问Db2。 这是一种情况,也许还有其他原因导致错误。