Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT client-side HTML5 database storage (Web SQL Database)

I wonder if there is an API for using Database Storage in GWT 2.x or I should use native code like this instead?

var database = openDatabase("Database Name", "Database Version"); 
database.executeSql("SELECT * FROM test", function(result1) { 
    // do something with the results 
    database.executeSql("DROP TABLE test", function(result2) { 
        // do some more stuff 
        alert("My second database query finished executing!"); 
    }); 
});  
like image 224
Antonio Avatar asked Feb 13 '11 08:02

Antonio


People also ask

Is Websql part of HTML5?

The Web SQL Database API is not a part of the HTML5 specification but it is a separate specification. It specifies a set of APIs to manipulate the client-side databases using SQL. The web SQL database works in the latest version of Safari, Google Chrome, Android browsers, and Opera.

Can HTML5 connect to database?

HTML5 is a static document, you cannot connect to a database with HTML5, but you can use php or javascript. Save this answer. Show activity on this post. HTML 5 drafts used to define a couple of database systems, but they have been broken out into separate specifications (Web Storage and Web SQL Database).

Does HTML5 have SQL support?

Complete HTML/CSS Course 2022The Web SQL Database API isn't actually part of the HTML5 specification but it is a separate specification which introduces a set of APIs to manipulate client-side databases using SQL.

What is Web SQL in Chrome?

The Web SQL Database API, which allows you to store data in a structured manner on the user's computer (internally based on the SQLite database engine), was introduced in April 2009 and abandoned in November 2010.


2 Answers

The gwt-mobile-webkit project provides these bindings so you don't have to write them yourself. Don't let the name fool you, it'll work on a desktop browser too.

like image 133
Jason Hall Avatar answered Sep 18 '22 02:09

Jason Hall


gwt-mobile-webkit as of now, will not run on the latest desktop browsers, since it uses the WebSQL API that is no longer supported by the latest browsers like Firefox 4+.

I have written a small library for doing client side storage. It can work with all browsers that support localstorage-api (practically all HTML5 browsers including the smart phone browsers) and allows you to store data in object stores and databases.

You can check it out here: https://code.google.com/p/gwt-localstorage-db/

like image 37
raghum Avatar answered Sep 18 '22 02:09

raghum