System.Data.SQLite
View Ticket
Not logged in
Ticket Hash: d1c4880f98e672f820b656dea9d75392dd0b5ff4
Title: Unable to open database on WIndows
Status: Pending Type: Incident
Severity: Important Priority: Medium
Subsystem: Connection Resolution: Works_As_Designed
Last Modified: 2020-04-06 21:46:13
Version Found In: 1.0.112
User Comments:
anonymous added on 2020-01-11 11:44:46:

Running tests from a project, I see a lot of failures with "unable to open database" errors. Tracing through decompiled code via rider, the problem seems to be in SQLiteConnection.MapUriPath, where a uri like file:///C:/Path/To/Database.db is being erroneously translated into /C:/Path/Do/Database.db and later on that is expanded to "C:C:PathToDatabase.db" by SQLiteConnection.ExpandFileName, which, of course, cannot be opened.

I would have raised a PR with a code fix, but I'm not sure how to do so considering the download source options from system.data.sqlite.org mention using Fossil or provide snapshot code. If this project were on GitHub (or something similar with a pull request workflow), I'd have provided a fix. Sorry.


mistachkin added on 2020-01-11 18:16:28:

Are you using the "Uri" connection string property? In that case, using three slashes is not supported. Per the documentation:

If specified, this must be a file name that starts with "file://", "file:",
or "/". Any leading "file://" or "file:" prefix will be stripped off and the
resulting file name will be used to open the database. 


mistachkin added on 2020-01-11 18:17:13:

In theory, this could be changed, but it would technically introduce a backward compatibility problem (e.g. somebody using a URI for a UNC path?).