SQLite: Cannot open network file programmatically, even though worked before

in version > 1.0.82.0

  1. Double the leading two backslashes in the file name (e.g. "\\\\network\share\file.db").

  2. Use a mapped drive letter.

  3. Use the SQLiteConnection constructor that takes the parseViaFramework boolean argument and pass 'true' for that argument.

See the SQL post here


Assuming the db file is accessible (e.g. "because SQLite Administrator can open the file"), then option #2 from the answer by ranmoro and GEEF seems to work. This becomes:

bool parseViaFramework = true;
con = new SQLiteConnection( cs, parseViaFramework );

in code. The rationale is discussed in the SQLite check-in comment "mistachkin added on 2013-05-25 21:06:45" in https://system.data.sqlite.org/index.html/info/bbdda6eae2

My connection strings are of the form:

URI=file:\\SERVER\Data\SqlData\History.db

for UNC paths, or

URI=file:C:\Data\SqlData\History.db

for local paths.

I am using:

Visual Studio 2022
<TargetFramework>net5.0-windows</TargetFramework>
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" />