I’m having a strange issue when trying to attach an encrypted database.
Using SQLite 3.28.0 with SQLCipher v4.2.0.
First I open up a database with the following commands:
sqlite3_open_v2("database1.db", ...);
sqlite3_exec(..., "PRAGMA key = 'password'; PRAGMA kdf_iter= 128000;", nullptr, nullptr, nullptr);
Everything is fine up to this point.
Now I try to attach another encrypted database:
sqlite3_exec(..., "ATTACH DATABASE 'c:/path/to/database2.db' AS db2 KEY 'password'; PRAGMA db2.kdf_iter= 128000;", nullptr, nullptr, nullptr);
The result of that action is SQLITE_NOTADB, yet that database is valid, and can be opened up using sqlite3_open_v2
.
If I open a non-encrypted database, and then attach another non-encrypted database, it works 100%.
Is there something I’m missing when trying to attach an encrypted database?
Any help would be greatly appreciated.