Attaching databases using backwards compatibility

I have some database created with SQLCipher version 3.
I opened main db and attached a few other database with different keys.
But there are some problems with attaching after upgrading SQLCipher to version4.
Even if I use
PRAGMA cipher_compatibility = 3;
after keying I can connect and work with main database, but I can not attach other database - the error code 26 is returned (SQLITE_NOTADB - the file being opened does not appear to be an SQLite database file).
It works with previous version of SQLCipher, but it doesn’t work now !
Can anyone have the same problem ?
Can anyone know how to resolve it ?
I didn’t find solution on forum :cold_sweat:

Hi @signum-net

Using the pragma cipher_compatibility settings are only for the current active connection. When you wish to adjust the behavior of future connections (such as invoking the ATTACH statement), you should use the pragma cipher_default_compatibility setting. Additional documentation on this is available here. Would you give that a try and let us know your results?

Good morning
Thank you very much for your help.

It seems it is working now with sqlcipher.dll :grinning:, but much slower than previous version (your build of sqlite3.dll) :thinking:

About 1,000 inserts takes about 3 times more time :thinking:

Hello @signum-net

We are happy to hear everything is working properly now. With regard to performance, there was a large increase in iteration length for PBKDF2 in SQLCipher 4, among other security improvements. You can review all the changes detailed here. Are you wrapping your batch inserts within a transaction? If not, doing so will improve the performance of your insert operations. You may wish to review our general performance guidance here in relation to your application.

Good Morning

Yes, all operations are in one transaction - but this “massive” operations including several thousands of inserts takes part only one time, while migrating data from other application - so it is not important.

Thank you for your help.

Previously, I received your building of sqlite3.dll and sqlite3.exe, but now I received only sqlcipher.dll. How can I get sqlite3.exe using sqlcipher.dll current version ?

Hello @signum-net

We have reached out directly regarding this.