Open external sqlite3 database in Javascript

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

Answers


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.)


Need Your Help

generating anchor and image tags for fancybox image gallery

image tags fancybox code-generation anchor

I have a simple html page and I want to make a very simple gallery to it with fancybox.

ARM-linux4.3.2, can't open socket with PF_PACKET type

c linux sockets arm cross-compiling

I'm using FriendlyARM with linux 2.6.29 and compiling with ARM-Linux GCC