I tried to connect to a database using phonegap. It seems that the database gets opened, but I am not able to create a table in the database. The execution seems to be stopped after the database creation. The next step using db.transaction is not working.
Code -
function createDB() {
alert("in createDB...");
var db = window.openDatabase("Database60", "1.0", "Phonegap Demo60", 200000);
alert("after openDatabase...");
db.transaction(
function(tx)
{
alert("in function(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(tx, err)
{
alert("Error processing SQL: "+err);
}
)
alert("after table creation...");
}