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 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 at 1:26

4 Answers 4

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 at 6:08

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

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

Forget Mozilla on this issue. If you want persistent, reliable and query enabled storage for your hybrid mobile apps, especially for Phonegap, this is the storage method to use.

share|improve this answer
1  
Why is that so? You are making a rather opinionated statement with nothing at this point to back it up or demonstrate why this is the case. –  MichaelT Jun 1 at 1:08
    
Waaaoooooo! Are you sure? Mozilla is great player in web world. You can't disregard IE, Chrome, Firefox and Safari if you are real web developer. –  QMaster Oct 29 at 20:33
    
To be fair, the user that posted this comment is specifically referring to hybrid mobile applications for which Mozilla is a non-issue. It's not about general web development. –  Steve Mitcham Nov 3 at 18:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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