I created a database with a default TFDConnection (no encryption) the following way.
How can I open this database by using TLiteConnection?
FDConnection1.Connected := False;
FDConnection1.Params.Database := 'testdatabase.db';
FDConnection1.Params.UserName := 'username';
FDConnection1.Params.Password := 'password';
FDConnection1.Connected := True;
when I try it this way:
LiteConnection1.Disconnect;
LiteConnection1.Database:= 'testdatabase.db';
LiteConnection1.Username:= 'username';
LiteConnection1.Password:= 'password';
LiteConnection1.Connect;
I am getting a message " File is not a database"
Access to database
Re: Access to database
Neither FireDAC nor LiteDAC/UniDac use SQLite's own encryption (because it's very expensive). Instead, they have both their own proprietary encryption method, which is incompatible to each other. By providing a password you switch on encryption.
Re: Access to database
So this means once created the database the Firedac method with password, I can't open it ever again in case I want to switch to a TLiteConnection? That's a bummer...
Re: Access to database
I can use FDSQliteBackup to create a copy of the database without the password and then I can open the copy with a TLiteConnection.
Is it possible to use LiteBackup to create a copy of this copy using the encryption from devart and if yes how?
Can someone point me to an example how TLiteBackup works?
Is it possible to use LiteBackup to create a copy of this copy using the encryption from devart and if yes how?
Can someone point me to an example how TLiteBackup works?
Re: Access to database
You can accomplish that task with our components. For example, the following sample code creates a copy of an encrypted database (LiteConnectionEncrypt) using the TLiteBackup component:
Code: Select all
...
LiteConnectionEncrypt.Database := 'C:\test.src';
LiteConnectionEncrypt.Options.EncryptionAlgorithm := leBlowfish;
LiteConnectionEncrypt.EncryptionKey := '11111';
LiteConnectionEncrypt.Open;
LiteConnectionDestination.Database := 'c:\test.dst';
LiteConnectionDestination.Options.ForceCreateDatabase := True;
LiteConnectionDestination.Open;
LiteBackup.SourceConnection := LiteConnectionEncrypt;
LiteBackup. DestinationConnection := LiteConnectionDestination;
LiteBackup.Backup;
...