A
A
Alexander Vishnev2021-12-20 12:20:46
Delphi
Alexander Vishnev, 2021-12-20 12:20:46

How to connect to a SQLite database with a set password?

I set the password on the database = '1'. Without encryption. On Windows everything connects fine.
But under Android, the application hangs on the Splash splash screen.
Set a password for Windows:

procedure TForm1.Button1Click(Sender: TObject);  
begin
  FDConnection1.Connected := False;
  FDSQLiteSecurity1.Database := pathEdit3.Text;
  FDSQLiteSecurity1.Password := '1';
  FDSQLiteSecurity1.SetPassword;
end;

Connection:
procedure TForm1.FDConnection1BeforeConnect(Sender: TObject);
begin
   {$IF DEFINED(iOS) or DEFINED(ANDROID)}
  FDConnection1.Params.Values['Database'] :=
      TPath.Combine(TPath.GetDocumentsPath, 'main_v3.sdb');

   FDConnection1.Params.Values['DriverID'] :='SQLite';
   FDConnection1.Params.Values['Encrypt'] :='enNO';
   FDConnection1.Params.Values['Password'] :='1';
  {$ENDIF}
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Vishnev, 2021-12-20
@fromdns

procedure TForm1.FDConnection1BeforeConnect(Sender: TObject);
begin
{$IF DEFINED(iOS) or DEFINED(ANDROID)}
FDConnection1.Params.Values['Database'] :=
TPath.Combine(TPath.GetDocumentsPath, 'main_v3.sdb');
FDConnection1.Params.Values['DriverID'] :='SQLite';
// FDConnection1.Params.Values['Password'] :='encryption-algorithm'+':' +'password';
FDConnection1.Params.Values['Password'] :='aes-128'+':' +'1';
{$ENDIF}
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question