Skip to content

non-encrypted db not being created by net.sqlcipher.database.SQLiteDatabase.  #100

Closed
@iffrah19

Description

@iffrah19

In my android app, I need to give user an option to create an encrypted or non-encrypted database; The database will be saved in device sdcard.

For the non-encrypted db I'm using :-

db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, "", null);

but when I open the db through command line,it gives error: file is encrypted or is not a database. So the above code line always creates encrypted database.

My code is below:

    if(db == null){
        try{
            SQLiteDatabase.loadLibs(context);
                    String encryptStr = "";

            if(new File(DB_PATH + DB_NAME).exists()){
                db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, encryptStr, null);
            }else{


                db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, encryptStr, null);
                executeSchema(context);
            }
            db.setVersion(1);
            db.setLocale(Locale.getDefault());
            db.setLockingEnabled(true);
        }catch(Exception e){
            db = null;
            AlertHelper.logError(e);
        }
    }

Any way to create non-encrypted database using sqlcipher in android?.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions