Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2
Accepted Solution

HTML5 Database issue

[ Edited ]

Hi,

 

I just wrote a small HTML5 database example and it is working on my new Bold 9900 (.353), but not on a Bold 9700 (6.0.0.570). The application is compiled with SDK 2.1.1

 

Code looks like:

 

var db; 

function openDB() {
	db = openDatabase("ToDo", "0.1", "A list of to do items.", 200000);

	if(!db) {
		alert("Failed to connect to database.");
	} else {
		alert("Connected to database");
	}

}


function createTable() {
	db.transaction(

	function(tx) {
		tx.executeSql("SELECT COUNT(*) FROM ToDo", [], null,
		function(tx, error) {
			tx.executeSql("CREATE TABLE ToDo (id REAL UNIQUE, label TEXT, timestamp REAL)", [], null, null);

                }
		);

	}
	);
}

function insertTable() {
	db.transaction(
		function(tx) {
			tx.executeSql("INSERT INTO ToDo (label, timestamp) values(?, ?)", ["TEST", new Date().getTime()], null, null);

		}

	);
}



function selectRows() {
	db.transaction(
	function(tx) {
		tx.executeSql("SELECT * FROM ToDo", [],
		function(tx, result) {
			for(var i = 0; i < result.rows.length; i++) {
			document.write('<b>' + result.rows.item(i)['label'] + '</b><br />');
		}
                }, null);

	}
	);

}

 

And idea?

 

Thanks.

 

bert2002

 

EDIT: is it because the Bold 9700 does not have a SD card?





----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: HTML5 Database issue

also the same happens to me.

This is a serious problem in version OS 6.0

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: HTML5 Database issue


chicoxml wrote:

also the same happens to me.

This is a serious problem in version OS 6.0


even when you have a SD card insert?



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: HTML5 Database issue

yes

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: HTML5 Database issue

[ Edited ]

I just inserted a memory card into the 9700er and it is working.



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: HTML5 Database issue

OS5   or  OS 6 ?

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: HTML5 Database issue

its OS6 (.570)



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: HTML5 Database issue

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: HTML5 Database issue

[ Edited ]

please try:

 

db  = openDatabase('documents', '1.0', 'Offline document storage',  5*1024*1024);

or can you try  my example from: http://blackberry.itbert.de/database/database.jad (OTA).





----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: HTML5 Database issue

your example did not work.