I have an sqlite3 database called mydb.db. It is an external file. Is it possible to open up this DB in javascript?
I tried the following code but this results in mydb.db being created wherever chrome creates it’s DB’s, so it clearly isn’t loading mine from file.
try {
if (!window.openDatabase) {
alert('Databases are not supported in this browser.');
} else {
var Name = 'mydb.db';
var version = '1.0'; //1.0
var displayName = 'TEST';
var maxSize = 100000; // bytes
database = openDatabase(Name, version, displayName, maxSize);
}
} catch(e) {
...
}
Thanks,
J
No. (At least not by this means.)
Allowing arbitrary file/database access would be a security vulnerability. Imagine a file “C:\My Documents\My Bank Data\transactions.sqlite” ..
(Actually, I’d expect browsers to sandbox/abstract the db “name” away from the physical file as a sane, but implementation-specific, strategy.)