I want to use SQLite in memory mode, and load a DB file that is stored inside the jar. Seems like SQLite can't find/load the file. Here's my code:
String dbpath = Resources.getResource("my-db.dat").getPath();
connection = DriverManager.getConnection("jdbc:sqlite::memory:");
File dbfile = new File(dbPath);
Statement statement = connection.createStatement();
try {
statement.executeUpdate("restore from " + dbfile.getPath());
} catch (Exception e) {
System.out.println("Error re-constructing in memory data base from Db file.");
}
The code isn't failing during restore, but when I try to query the DB I'm getting an error (org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: my_table)
).
Things do work in regular mode (not in-memory).