storesafe/cordova-sqlcipher-adapter

file is not a database: , while compiling: select count(*) from sqlite_master;

suriyacs opened this issue · 3 comments

Hi

I have trying to integrate cordova-sqlcipher-adapter for my ionic3 hybrid mobile app. while trying to open connection for android device to the database i have received "Could not open a connection error" I have debugged inside an plugin and found file is not a database: , while compiling: select count(*) from sqlite_master;

I don't know what's wrong in my code Here my connection details i have submitted for reference

createConnection({
type: 'cordova',
database: this.dbName,
location: 'default',
logging: ['error', 'schema'],
synchronize: false,
entities,
migrations,
migrationsRun: true,
extra: {
key: "test"
}
});

Have used typeorm for the connection

Here typeorm/typeorm#1272 they have mentioned extra option will be used to set the key.

trying to encrypt ionic native sqlite database

Can you let me know what should l change!?

I have not been actively testing with Ionic3 or TypeORM. I would highly recommend that you post an app with a minimal, reproducible example ([1]) to demonstrate the observed behavior so that others can help take a look.

[1] https://stackoverflow.com/help/minimal-reproducible-example

Closing due to lack of minimal reproducible example.

I was getting this error after migrating from regular SQL to SQLCipher. It turns out that Android backups DBs and on re-install was restoring the old one, while Ionic was creating the new one. This fix worked for me.
https://stackoverflow.com/a/54997687/6321055