How to access the Sqlite database with javascript?

advertisements

This question already has an answer here:

  • Is it possible to access an SQLite database from JavaScript? 6 answers

Is it possible to access the sqlite database with the help of javascript,if yes then can you please provide me a sample code please.


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

credit: SO Question: JavaScript sqlite

How to access the database using ajax and php ?