Google News
logo
What is Web SQL Database in HTML 5?


Web SQL is a very interesting feature, even though it isn't part of the HTML 5 specification but it is a separate specification and it can still help to develop Web Applications.
Web SQL is used to manipulate a client-side database. Since I am saying that it is good to use, there is a disclaimer for its use; it is risky because it stores data at the client-side, not on the server-side. So always remember, don't store information sensitive to the server inside it.
 
Note: A Web SQL database only works in the latest versions of Safari, Google Chrome and Opera browsers.
Core Methods of Web SQL
 
The following are the 3 core methods of Web SQL that I will cover :

* openDatabase
* transaction
* executeSql

Creating and Opening Databases
 
Using the openDatabase method, you can create an object for the database. If the database doesn't exist then it will be created and an object for that database will be created. You also don't need to worry about closing the connection with the database.
 
To create and open the database, you need to use the following syntax.
 
var dbObj = OpenDatabase('[Database_Name]', '[Version_Number]', '[Text_Description]', '[size]', '[Creation_Callback]’)
LATEST ARTICLES