System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 283344397b4a4d8b2e6253805711e43b10285eaf
Title: Cannot open SQLite database file on network share
Status: Closed Type: Feature_Request
Severity: Important Priority: Medium
Subsystem: Connection Resolution: Fixed
Last Modified: 2014-02-28 01:34:19
Version Found In: 1.0.91.0
User Comments:
anonymous added on 2014-02-27 11:46:09:

Using System.Data.SQLite 1.0.91.0, I am unable to open a connection to a database file on a network share from my .NET windows application. When I try and do so, I get the following exception:

System.Data.SQLite.SQLiteException
ErrorCode: 14
Message: "unable to open database file"
ResultCode: CantOpen
StackTrace:
    at System.Data.SQLite.SQLite3.Open(String strFilename, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, Int32 maxPoolSize, Boolean usePool)
    at System.Data.SQLite.SQLiteConnection.Open()
    at [MyApp.MyCode ...]

I've ensured that I have full read/write permission on the network share. I am able to save, open and edit other types of file there. I had been using System.Data.SQLite 1.0.81.0 previously, and was not getting this error - I've just tested it on the exact same network share and it can open files without a problem.

Interestingly, with 1.0.91.0, the following statement successfully creates a file on the network share:

SQLiteConnection.CreateFile(fileName);

But immediately followed by:

using (var connection = new SQLiteConnection(string.Format("Data Source={0}", fileName))) {
    connection.Open();
    ...
}

It crashes with the above exception on the line connection.Open();.

Can you help? Has a breaking change been made somewhere between version 1.0.81.0 and 1.0.91.0?

In case it's relevant, my data source string is simply in the format \\SERVERNAME\sharename

(Also, I can successfully use 1.0.91.0 to create/open local database files without a problem)

Thanks.


anonymous added on 2014-02-27 12:26:02:
OK, I found a solution on StackOverflow:

http://stackoverflow.com/a/18506097/672827

(I used the first option - four leading backslashes)

I'm leaving this open in case it's a bug anyway. At the very least, I'd suggest adding a detection and output trace warning about not supporting the "\\SERVER\share" data source format.

Thanks.

mistachkin added on 2014-02-27 22:27:25:
This is a feature request to issue a warning for network share paths that do not
being with four backslashes.

mistachkin added on 2014-02-28 01:34:19:
Feature request is now on trunk via check-in [c632d5743c].