Skip to content
100% JavaScript implementation of Web SQL API
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

100% JavaScript implementation of Web SQL API

Pure-JS-WebSQL is an implementation of Web SQL Database API in pure JavaScript.
The implementation provides a glue between Web SQL Database API and SQL.js (SQLite port to JavaScript). The data between sessions is stored in the localStorage.


Pure-JS-WebSQL Demo. It should work in any Gecko- or WebKit-based browser.


   <!--Note: GitHub does not allow linking to .js files on their servers anymore.
       You must download two following .js files and host them on your own server. -->
   <script src=''></script>
   <script src=''></script>
      openDatabase = purejsOpenDatabase;

      // now you may use Web SQL API as if it is supported by your browser:
      var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
      db.transaction(function (tx) {
         tx.executeSql('DROP TABLE IF EXISTS foo');
         tx.executeSql('CREATE TABLE IF NOT EXISTS foo (id unique, text)');
         tx.executeSql('INSERT INTO foo (id, text) VALUES (?, ?)', [1, 'synergies']);
         tx.executeSql('SELECT * from foo', [], function(tx, result) {
            alert('id = ' + result.rows.item(0).id + ', text = ' + result.rows.item(0).text)


Pure-JS-WebSQL is released under the MIT license.

Something went wrong with that request. Please try again.