jeudi 10 septembre 2015

Delphi/Firemonkey SQlite unable to open database with WAL mode

I have a Firemonkey App which uses a local SQLite database that is populated from a remote MySQL Database, The connection parameters for the FireDAC FDConnection to SQLite have been setup as follows

procedure SetLocaldbconnection(Con : TFDConnection)
begin
    Con.DriverName:='SQlite';
    Con.Params.Add('LockingMode=Normal');
    Con.UpdateOptions.LockWait := True;
    Con.Params.Add('Synchronous=Full');
    Con.Params.Add('SharedCache=False');
    Con.Params.Add('JournalMode=WAL');
    Con.Params.Values['Database'] := TPath.Combine(TPath.GetDocumentsPath, 'drioddb.s3db');
    Con.Connected:=True;
end;

And then throughout the App connections are created and used and it works. But I have a TTimer that executes every 10 secs that will start a Task(ITask) and this will then do checksums to see if any of the remote data at MySQL side has changed, if a tables checksum doesn't match the data is downloaded, and once again this works perfectly

I check that the Task can not start if it is already running, and I also encounter no deadlocks.

But after a few updates and queries suddenly I will get a unable to open database error

My App does have External Read/Write access, so the WAL file can be created, but I am not sure that this is the issue because even if I set the JournalMode=Memory after alot of qeuries I will get the same error?

Aucun commentaire:

Enregistrer un commentaire