Got error 26 when attaching a non encrypted sqlite db to an encrypted db

I’m receiving an “Error 26: file is encrypted or is not a database” when executing this:

EncryptedDB.AttachDatabase(UnencryptedDatabaseFile, "res")
  • EncryptedDB is already connected with a valid encryption key.
  • UnencryptedDatabaseFile is a folderItem that points to a non-encrypted sqlite database file.
  • I have also another property of type SQLiteDatabase which is already connected without problems to the UnencryptedDatabaseFile.

I have also tried doing:

EncryptedDB.AttachDatabase(UnencryptedDatabaseFile, "res", EncryptedDB.EncryptionKey)

But I get the same error…

Any thoughts? Thanks!

Some interesting findings regarding this issue…

If done the other way around, attaching the encrypted database to the unencrypted database, it works perfectly.

Also, it works if both databases are encrypted, even if they don’t have the same encryption key.

So my best guess is Xojo’s implementation of the AttachDatabase function is broken somehow…

error 26 (if I recall) indicates an attempt to open a database as if it were encrypted, when in fact it is not

@Dave S - It also appears when trying to access an encrypted database with the wrong encryption key.

that is also true… basicaly “Error 26 - the key you provided is not correct for this database”

Anyways, as you can see from my original and following posts, that was not the case…