I just want to start off by saying that I have found out Stack questions that are similar if not the same, but the answers there don't work.
I am just wanting to make a smallish database so I can query all of my items in storage. I thought I would try out SQLite because people say that it is easy to use and lightweight.
Here is the question/answer that doesn't work: sqlite3 create database with callback using node and here is the reference from sqlitetutorial.net
Here is my code and the errors I am getting. I don't understand why it is not just creating a new database.
'use strict'
// Open the database in memory
const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database('/db/storage.db', (err) => {
if (err) {
console.error(err.message);
} else {
console.log('Connected to the in memory SQlite database.')
}
});
// Close the database
db.close((err) => {
if (err) {
return console.error(err.message);
}
console.log('Close the database connection.');
});
Then the error message is
SQLITE_CANTOPEN: unable to open database file
Segmentation fault (core dumped)
Or then if I use the sqlite3.OPEN_CREATE parameter, I get this error.
SQLITE_MISUSE: bad parameter or other API misuse
Segmentation fault (core dumped) code here
So I don't entirely know what's wrong here, as it's just my first hour messing around with it but it seems many others have had this issue.