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

后端 未结 3 1201
终归单人心
终归单人心 2021-02-04 03:06

I have used the code below to open a SQLite database file that sits on a network computer for more than a year now almost on a daily basis. Suddenly this morning, I am not able

相关标签:
3条回答
  • 2021-02-04 03:56

    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

    0 讨论(0)
  • 2021-02-04 03:56

    I had a similar issue. Replacing the UNC (\server\share\folder\file.db) with a mapped drive path (S:\folder\file.db) resolve the issue in my instance.

    0 讨论(0)
  • 2021-02-04 03:56

    The error message is very misleading + irritating. Applications working fine in the local environment get failed to start in client server situation.

    It has mostly noting to do with the code. Its related to server side.

    • Make sure the Write access is available for the server folder containing the file.

    • UNC [IP based server path] is not supported still, the network path/folder should be mapped to overcome this issue.

    • Some sites+users are saying to mention the Version No. in the connection string. All my applications are working fine without using it.

    Connection String:

    Data Source=[Mapped Server Location]\[SubFolders]\[FileName].db;
    

    Update:

    I tried to prepend \\ to the UNC path and it worked (added additional \\ in the beginning only, not in-between).

    Data Source=\\[UNC]\[SubFolders]\[FileName].db;
    
    0 讨论(0)
提交回复
热议问题