Node-sqlite3: Unable to open database file on windows 10

Created on 3 Jul 2018  路  3Comments  路  Source: mapbox/node-sqlite3

Hi I have built out an application in Linux, my client then asked for a Windows Version.
I was able to make the necessary adjustments. However when I execute I get a cannot open database error.
I went through and tried to create a new database with the code to see if the issue was the database itself.
The code was able to build the database( created a 0 bite database with the name) however it would still return the error that was unable to open the database.

Are there any suggestion for how to dig deeper with logging to see what the issue could be? I have read about the temporary files that are created and placed the database in a folder that the user has complete control over.

The same code connects and functions properly on Linux it is just Windows that the issue.

Thanks
Robert Stojkovic

Most helpful comment

HI
I wanted to add something to this issue.
Clarification on the issue
Error thrown is below

events.js:183
throw er; // Unhandled 'error' event
^

Error: SQLITE_CANTOPEN: unable to open database file

Robert Stojkovic

All 3 comments

HI
I wanted to add something to this issue.
Clarification on the issue
Error thrown is below

events.js:183
throw er; // Unhandled 'error' event
^

Error: SQLITE_CANTOPEN: unable to open database file

Robert Stojkovic

I've found a very strange caveat to this. In the node shell on Windows, it is possible to open and operate on the database. However when running it within a function it throws that error.

Hi, bro! I also ran into this problem recently, and I found that if I opened the database file before creating the database but did not close it properly, this error would be raised. For example, fs.open is called but fs.close is not. Once I shut down the database properly before creating it, the error disappeared. I hope it helps you

Was this page helpful?
0 / 5 - 0 ratings