The Wayback Machine - https://web.archive.org/web/20081218135949/http://stackoverflow.com:80/questions/61972/javascript-sqlite
vote up 2 vote down
star

Best recommendations for accessing and manipulation of sqlite databases from JavaScript.

offensive?
comments (1)

4 Answers:

vote up 1 vote down
check

Well, if you are working on client side JavaScript, I think you will be out of luck... browsers tend to sandbox the JavaScript environment so you don't have access to the machine in any kind of general capacity like accessing a database.

If you are talking about an SQLite DB on the server end accessed from the client end, you could set up an AJAX solution that invokes some server side code to access it.

If you are talking about Rhino or some other server side JavaScript, you should look into the host language's API access into SQLite (such as the JDBC for Rhino).

Perhaps clarify your question a bit more...?

link|offensive?
comments (2)
vote up 5 vote down

Google Gears has a built-in sqlite database - but you'll need to ensure that people have it installed if you plan to rely on it.

Depending on your circumstances, you may be able to enforce installation, otherwise you should treat it as a nice-to-have, but have graceful degradation so that the site still works if it isn't installed.

link|offensive?
add comment
vote up 1 vote down

If you're running privileged scripts in Windows (either in an HTA or WSH), you can access ODBC data sources using an "ADODB.Recordset" ActiveXObject.

If you're talking about client side on a web page, the above post re: Google Gears is your best bet.

link|offensive?
add comment
vote up 1 vote down

If you're looking to access SQLite databases on the browser (ie. client side) you'll need your browser to support it. You can do it with SpiderApe http://spiderape.sourceforge.net/plugins/sqlite/ which assumes that browser is Mozilla based (ie. with SQLite support). You'll still need to allow access to the underlying libraries ( http://www.mozilla.org/projects/security/components/signed-scripts.html )

If you're looking for serverside access from Javascript programs to SQLite databases there are several options: JSDB is one http://www.jsdb.org/ ; JSEXT another http://jsext.sourceforge.net/ ; and jslibs another http://code.google.com/p/jslibs/

-- MV

link|offensive?
comments (1)

Not the answer you're looking for? Browse other questions tagged or ask your own question.