Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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
    
Just a little remark from someone who has to support both localStorage, indexeddb and websql as underlying storage techs: find an existing wrapper technology and just use that. I would go with IndexedDB, as it is available on Android 4.4+ and iOS 7, and there is good adapter tech available that makes it feel like you are using indexeddb even when it is not available (on older devices). –  oligofren May 9 '14 at 7:10
    
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
    
@oligofren, If you are using more-than-just-brain-dead-simple SQL in web SQL, you can't exactly translate that to localStorage and etc. –  Pacerier Jun 23 at 2:55
    
@Pacerier Of course. But that assumes you have already committed to WebSQL and invested lots of resources into that. My tip was assuming TS was still pondering what tech to choose. WebSQL cannot be emulated by LocalStorage, but IndexedDB can be emulated by WebSQL quite nicely. And these days, IndexedDB is even more prevalent than it was when I wrote that. –  oligofren Jun 24 at 16:58
1  
@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

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?

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]caniuse.com/#feat=sql-storage . 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: html5rocks.com/en/features/storage –  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

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.