Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqliteError "no such table" #220

Closed
k1ngrnbz opened this issue Jan 17, 2019 · 5 comments
Closed

SqliteError "no such table" #220

k1ngrnbz opened this issue Jan 17, 2019 · 5 comments

Comments

@k1ngrnbz
Copy link

Hey Guys,
i just created an exe of my electron project. After running the exe i get this Error in my console:

SqliteError
code: "SQLITE_ERROR"
message: "no such table: settings"
stack: "SqliteError: no such table: settings↵ 

i used electron-packager ./ DC --platform=win32 --arch=x64 for building my exe.

@JoshuaWise
Copy link
Member

This probably means you opened up a new (empty) database because there was no existing database at the file path you specified.

Try adding the option { fileMustExist: true } when opening the database. This will confirm or deny my theory.

@JoshuaWise
Copy link
Member

@k1ngrnbz Any progress on this issue?

@k1ngrnbz
Copy link
Author

Hey @JoshuaWise my electron app does connect to an sqlite3 database which already exists and is full of data which works. But when i'm trying to create my windows exe file the same database is in the resources folder. But i get this error. There is no database which is empty.

@JoshuaWise
Copy link
Member

@k1ngrnbz Since better-sqlite3 doesn't do anything fancy with file paths, it seems that this issue is related to electron-packager, and not better-sqlite3 itself. I'll close this issue, but feel free to look for support in the dedicated electron help thread.

@i-chaochen
Copy link

I had the same issue, fixed it by change the db connection by path

const db = new Database(path.resolve(__dirname, 'myDB.db'), {fileMustExist: true});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants