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

后端 未结 3 1196
终归单人心
终归单人心 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

    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;
    

提交回复
热议问题