System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 01a6c83d51a203ffb8b6fa0a5199e12634c0f10c
Title: SQLiteConnectionStringBuilder incorrectly handles UNC paths
Status: Closed Type: Incident
Severity: Minor Priority: Medium
Subsystem: Convert Resolution: Works_As_Designed
Last Modified: 2013-08-23 05:34:25
Version Found In: 1.0.88.0
User Comments:
anonymous added on 2013-08-22 07:31:24:
When trying to build a connection string with SQLiteConnectionStringBuilder and submitting an UNC-path (File on a server, not mounted as network drive, path starts with two backslashes), the string builder handles the path incorrectly, leading to a wrong conenction string.

Example (C#):

    var c = new SQLiteConnectionStringBuilder()
                        {
                            DataSource = @"\\servername\path\test.s3db"
                        };

    Console.WriteLine(c.ConnectionString); // Results in 'DataSource=\\servername\path\test.s3db'

    var s = new SQLiteConnection(c.ConnectionString);
    s.Open();  // Generates an exception: Unable to open database file


Replacing the \\ with three backslashes solves the problem:

    var s = new SQLiteConnection(c.ConnectionString.Replace(@"\\", @"\\\");
    s.Open();  // Works

mistachkin added on 2013-08-23 04:42:03:
Also see ticket [bbdda6eae2].

mistachkin added on 2013-08-23 05:34:25:
As you already figured out, the "fix" for this issue is to double the leading
double backslashes in the data source file name.