Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I am making a hybrid Android app.

At first I decided to use localStorage, after spending 2 days, I realized that it is very strange and so dropped it.

Then, I picked up indexedDB, after spending today's whole day and actually getting the output in Google Chrome, it is not running inside a WebView of the android app.

And I never used Web SQL database at all because it was deprecated. Anyhow, it has come to my notice that PhoneGap still uses Web SQL and android's browsers support it.

Why was Web SQL deprecated in the first place? And will it be a good idea for me to go with Web SQL now?

share|improve this question
What did you find strange about localStorage? It's just a key/value pair store. I'm curious what you didn't like about it and the type of problems you ran into. I'm using it in a project and would like to know the case issue you ran into. – jmq Jun 1 '14 at 1:26
But save yourself the hassle of creating an abstraction layer (which I did), and just use YDN-DB for now It will use the best available tech for that device. – oligofren Jun 24 at 17:04
@oligofren, Speed and performance at the magnitude of 100 milliseconds is important to me. I can't use abstraction layers. – Pacerier Jun 26 at 23:52
You are always using an abstraction layer of some sort. That's programming and how you achieve consistent behaviour regardless of implementation bugs in the browser. Dummy js calls exceed 5000 per ms, so unless the author of YDN-DB has done something ridiculously stupid, you should not get a performance hit anywhere near the order of 100ms. More like 1ms, for 1:1 ops, on platforms that don't support IndexedDB natively. Which, at the moment, is only older versions. All current browsers support IndexedDB. WebSQL is deprecated. And try some simple profiling before you "optimize" away tech :-) – oligofren Jun 29 at 20:15
@oligofren, You're missing the point of my comment. I'm not talking about the overhead of one function calling another and viceversa. I'm saying when you use a db abstraction layer you are limiting yourself to a subset of SQL query patterns you can use without suffering from performance penalities. You can do no tuning because the library does it for you automatically and don't always get it correct. It's not going to be 1ms unless you store only 1 row of data. – Pacerier Jul 2 at 12:35

3 Answers 3

Short version: Web SQL was deprecated because standards are really important and turning Web SQL into a proper standard would have been prohibitively difficult.

Since existing implementations of Web SQL are basically wrappers around SQLite, any attempt to define a standard of it was basically "do what SQLite does." This isn't good enough; a true standard needs to be self-contained, to define the interface and corner cases and exceptions itself instead of pointing to an existing implementation (especially a third-party implementation like SQLite). Otherwise, you run the risk of taking one particular implementation's quirks and enshrining them as the standard. From what I've read, the W3C prefers multiple independent implementations of proposed standards to help ensure that this happens; since Web SQL was so tied to SQLite, that just wasn't going to happen.

Mozilla's blog gives more details on their reasoning in particular for not supporting Web SQL; apparently they were one of the major voices in getting Web SQL deprecated.

Should you go with Web SQL now? I don't expect the vendors that currently support it (like Google and Apple) to drop it any time soon, but IE and Firefox won't be adding it, and since it's deprecated, why invest in it? (For example, Ido Green, with Google Developer Relations, doesn't recommend using it.)

share|improve this answer
That post by Ido is super basic and doesnt even scratch the surface on why one should use one or the other. the fact is, noSQL databases were designed with large size in mind, and that just doesnt apply to a database running on a user's single computer. You may gain some advantages relevant to big data, but you lose stuff like JOINs. There is no way I could have developed my open-source "Plus for Trello" chrome extension if I had to use indexedDb (and I do use noSQL datastore in appengine) so I went for web sql. – Zig Mandel May 24 '14 at 6:08
@Josh, Sounds like the Standards-TM guys want another round of XHTML-vs-WhatWG battle. So without WebSQL now on FireFox, you are suggesting to use localStorage? – Pacerier Jun 23 at 2:57
In case anyone wants the full history of Web SQL's deprecation, this blog post has details and links for further readong. – Josh Kelley Jun 30 at 17:56
Because the Google GMail MS-Outlook competitor could then do fulltext-search, and because "embrace, extend, exterminate" is not possible when there's only one SQLite implementation (MS), and because Jonas Sicking (Mozilla) doesn't like SQL. Key value stores with an overcomplicated interface are of course that much better (aka in hyphe), especially since every JavaScript object is already an associative array. And let's face it, data normalization, referential integrity and set-based operations really are revolting for someone who doesn't (wantTo) understand SQL, aka "The users don't want SQL". – Quandary Jul 17 at 11:53

Josh Kelley's answer is so far the BEST answer ever I've found about the reason of the standard work to be stopped. That said, I think there is an additional perspective to consider regarding the user-base.

Eventhough, I disagree on Ido Green's approach to the subject ("This is a recommendation for web developers to no longer use the technology as effectively")...

I believe (as vi4m states in the comments of Ido Green's article):

We (developers) can still use this technology. No browser vendor requested removal of this technology, nor plan to remove it. Developers are the voice of the web. We can just still using it, maybe Mozilla will change mind ;-)

And I would add another logical approach: If you are developing for mobile ambient... ¿what ambients are in more hands? Answer: iOS and Android... So if BOTH support webSQL, and your target is MASSIVE MOBILE, go for it!

Think as big apps have done almost always at the beggining, get the MOST first, then (once achieved success) recreate the work to get the remaining less (if you really want to achieve them or are asked to do so). Finally, ins't always success who marks the path?

After reading Nolan Lawson's article (in which is clear his intention to give a chance to his invention) I believe this matter became a new cold-war between tech-giants that shouldn't even exist. I believe specs are made to stay (as -longer and untouched as possible- the better for client oriented performance). Ironically the "specs guys" job is to generate NEW specs (sometimes where there is none needed, so he can have something more to do), and likewise programmers jobs sometimes focus on changing and rewriting what already works instead of doing solutions for new problems and new tendencies.

For me, Client-Side Databases was a matter of simply making parallels (between server and client sides) so we could create, store, upload and download data easily. Under this approach, having the same languages and structures (at least for us, LAMP opensource developers) is straight forward and logic.

I believe IndexedDB intention for being an alternative with wider and newer possibilities is an always good approach, but somehow it resembles for me to the need of developing software that NEEDS to be installed (even when the core solution can stay on the cloud). In a world that tends to stay connected it sounds like A) a matter of control and possession or B) focusing on developing monsters for the client-side... but for those kind of needs exist Apps (in the Mobile world) and software (in the PC world). I believe the goal of Webapps should stay mainly on extending the web no matter the device.

I believe a nice infographic could come out of this approach.

share|improve this answer
Please note that recent Firefox versions and IE do not support WebSQL at all. – Slomojo Mar 25 at 0:00
As far as I know they have never supported WebSQL. You can check that here: [link] . The only one that amazes me is Opera Mini, they are loosing market this way. Anyways, for me as developer the only ones that matter are iOS and Android for WebApps, and sameways WebKit which I believe is both's systems engine. – davidtaubmann Apr 8 at 19:33
Nevertheless, no client-side storage standard has been adopted by all commercial browsers: – davidtaubmann Apr 8 at 20:39

The reality is that the contributing parties reached an impasse on the direction of the standard. In short, no one could agree.

The W3C site explains this.

The specification reached an impasse: all interested implementors have used the same SQL backend (Sqlite), but we need multiple independent implementations to proceed along a standardisation path.

WSC site

share|improve this answer
For me, this somehow means they agree there's nothing else to standardize in that path... It works fine the way it is because it connects the path of the standard to an existing third party technology that should/may not be standardized by them. – davidtaubmann Apr 8 at 19:54
For me that sound like: They disagreed on it, because it doesn't allow for vendor-specific features (embrace, extend, exterminate?). – Quandary Jul 17 at 11:30

protected by gnat Feb 8 at 8:46

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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