HTML5 – Bye Bye ‘WebSQL’/’SQLite’ – Welcome ‘IndexedDB’

Since November 18, 2010, the W3C announced that Web SQL database(Sqlite) is a deprecated specification. This is a recommendation for web developers to no longer use the technology as effectively, the spec will receive no new updates and browser vendors aren’t encouraged to support this technology. The new alternative is IndexedDB which is already available on Chrome 12+ and Firefox 5+, and, soon, in IE 10 as well.

The new web database standards adoption progress report as per Html5Test.com – how standards setting can work well.

  • WebKit browsers originally shipped a copy of the SQLite — an embedded relational database — and then proposed “WebSQL” as a specification to standardize it.
  • Mozilla objected to its standardization on the grounds that the SQL 92 standard was a poor basis for a web standards technology, and that an implementation (SQLite) shouldn’t be the basis for standard.
  • As a result, WebSQL standardization was abandoned in favor of a new database standard, IndexedDB which is now the standard database of record for all major browsers.
  • Firefox, IE and Chrome now support IndexedDB on the desktop.
  • Chrome for Android is the first browser to support it on mobile devices.
Category WebSQL IndexedDB
Advantages A real, relational database implementation on the client (SQLite). * Allows fast indexing and searching of objects, so in a web application scenario, you can manage your data and read/write it fast.
* A NoSQL database that let you work with your JavaScript objects and indexing them based on your application needs.
* Works in asynchronous mode with moderately granular locking per transaction. This allows you to work inside the event-driven module of JavaScript.
Disadvantages * The spec is deprecated.
* Overhead of SQL language you need to master and transform your JavaScript objects into relational schema
* Not object driven
Harder to understand if you are coming from the world of relational databases.
Location Tables contain columns and rows objectStore contains Javascript objects and keys
Query Mechanism SQL Cursor APIs, Key Range APIs, and Application Code
Transaction Lock can happen on databases, tables, or rows on ‘readwrite’ transactions Lock can happen on database ‘versionchange’ transaction, on an objectStore ‘readonly’ and ‘readwrite’ transactions.
Transaction Commits Transaction creation is explicit. Default is to rollback unless we call commit. Transaction creation is explicit. Default is to commit unless we call abort or there is an error that is not caught.

Ref Link:

http://www.w3.org/TR/IndexedDB/

http://www.html5rocks.com/en/tutorials/webdatabase/websql-indexeddb/

http://www.steveworkman.com/html5-2/standards/2011/the-limitations-of-websql-and-offline-apps/

http://www.html5rocks.com/en/tutorials/indexeddb/todo/

http://html5test.com/compare/feature/storage-sqlDatabase.html ( WebSQL – Current Support on browsers)

http://html5test.com/compare/feature/storage-indexedDB.html ( IndexDB – Current Support on browsers)