HTML5's IndexedDB: tutorial series
Join the DZone community and get the full member experience.Join For Free
As a former database developer/admin, I'm often tempted to think of all computers as datastores that sometimes store particularly interesting data. After all, the most fundamental split in modern computer architecture occured over exactly where different kinds of data (including instructions) are stored.
Some of the confusion over HTML5's new database support has orbited around the data/instruction issue too. For some clarification on that front, look over Gerard Gallant's post from a few weeks ago. As Gerard observes:
To avoid any confusion, HTML 5 Web Storage is not the Index Database API or the Web SQL Database which are also HTML 5 related features that some browsers have started to support.
HTML 5 Web Storage is a form of browser storage that is similar to cookies but with several advantages.
Gerard goes on to list and discuss some of these advantages (worth browsing).
But in a way (as Gerard observes) Web Storage isn't fundamentally different from cookies. It's just a lot more powerful.
IndexedDB, on the other hand, is something different altogether. The specification is designed specifically for applications that address much larger stores than browsers using Web Storage will permit (usually just 5MB).
You can read the full spec (specs are always fascinating until they alter your state of consciousness), but for a quick overview you'd probably prefer a developer's perspective over W3's.
Providing that developer's perspective, Kristof Degrave just updated his multi-part tutorial series on creating and deleting a database, opening and a closing database connection, and defining a database structure in IndexedDB, with a nice little 'IndexedDB basics' intro thrown in for good measure.
Kristof's summary of the specification gets to the heart of IndexDB's power:
The Indexed DB specification provides an advanced key-value data management. It does this by using a transactional database to store their keys and corresponding values (more than one value for 1 key is allowed) and providing a means of traversing keys in a deterministic order.
Opinions expressed by DZone contributors are their own.