Page 1 of 1

SQLite and remote access

Posted: Tue 09 Aug 2022 16:17
by yeohray2
I have a project that connects to a SQLite database file on a network share. Say I access that file from my application running on MachineA and MachineB. I connect from MachineA, then connect from MachineB. If I try to disconnect from MachineB, the Disconnect procedure waits until MachineA has disconnected.

I have tried various options like setting the ConnectMode to ReadOnly, LockingMode to lmNormal, ReadUncommitted to True etc, using both Direct mode and a SQLite3.dll, but MachineB will still wait for MachineA to disconnect before it can disconnect.

Is there some setting I'm missing? I tried the same code using FireDac, and it works without any issues.

My test code is pretty simple, just the connection component and a button to connect/disconnect:

procedure TfrmMain.btnConnectClick(Sender: TObject);
begin
if connMain.Connected then
begin
connMain.Disconnect;
Self.Caption := 'Disconnected';
end
else begin
connMain.Connect;
Self.Caption := 'Connected';
end;
end;

Thanks in advance.

Ray

Re: SQLite and remote access

Posted: Wed 17 Aug 2022 12:57
by MaximG
Please be informed, that we've checked access to the SQLite database file test.db3 with the following code:

...
UniConnection.ProviderName := 'SQLite';
UniConnection.SpecificOptions.Values['Direct'] := 'True';
UniConnection.DataBase := '\\Share folder\Static\test.db3';
UniConnection.Connect;
...

Kindly note, that we successfully connected in this way to the database on the network resource 'Share folder' from two independent computers.

Re: SQLite and remote access

Posted: Thu 18 Aug 2022 10:00
by yeohray2
Noted, The problem was that I was using WAL journaling mode, which isn't supported for network access. Reverting to 'normal' journallng mode resolved the issue.

Thanks.