Follow this tutorial to learn how to use/create SQLite database in phonegrap (from official doc).
var db = window.openDatabase("test", "1.0", "Test DB", 1000000);
This method will create a new SQL Lite Database and return a Database
object. Use the Database Object to manipulate the data.
Syntax + Tutorial:
window.openDatabase(name, version, display_name, size);
Example from the page:
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
}
function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
function successCB() {
alert("success!");
}
var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
db.transaction(populateDB, errorCB, successCB);
I found this tutorial too.