SQLite and remote access

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yeohray2
Posts: 21
Joined: Thu 08 May 2014 15:49

SQLite and remote access

Post by yeohray2 » Tue 09 Aug 2022 16:17

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

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: SQLite and remote access

Post by MaximG » Wed 17 Aug 2022 12:57

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.

yeohray2
Posts: 21
Joined: Thu 08 May 2014 15:49

Re: SQLite and remote access

Post by yeohray2 » Thu 18 Aug 2022 10:00

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.

Post Reply