Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite database file can't be opened when placed in network folder

Can someone help me to understand why this works fine...

Dim cs = "Data Source=C:\folder\Livros.sdb;Version=3;"
Dim cn = New System.Data.SQLite.SQLiteConnection(cs)
cn.Open() ' no exception 

... while this breaks when opening connection (it is exactly the same file)...

Dim cs = "Data Source=\\NetworkServer\folder\Livros.sdb;Version=3;"
Dim cn = New System.Data.SQLite.SQLiteConnection(cs)
cn.Open() ' exception: {"unable to open database file"}

... and fix it because I need to place database file in network location so I can access it regardless of the computer I run the application?

Thank you very much!

like image 679
VBobCat Avatar asked Jul 02 '26 22:07

VBobCat


1 Answers

Ok, so by trial and error I found the solution, although I can't quite understand the reason it works:

Dim cs = "Data Source=\\NetworkServer\folder\Livros.sdb;Version=3;"
Dim cn = New System.Data.SQLite.SQLiteConnection(cs)
cn.ParseViaFramework = True ' JUST ADDED THIS STATEMENT
cn.Open() ' no exception

If somebody can explain why .ParseViaFramework = True does the trick, please feel free to comment.

like image 138
VBobCat Avatar answered Jul 04 '26 12:07

VBobCat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!