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
Highlighted
Contributor
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers
Accepted Solution

html5 openDatabase() fails

[ Edited ]

Hi,

 

I seem to be running into a problem trying to open a database using my widget. (I am using the updated "html5_init.js" files ) Below is a brief explanation of what I am trying to do...

 

I have a launch page that opens the database using the code below and creates a table. Once this is done, it redirects to the main page. 

 

 

 var db = null;
   db = openDatabase("myDB", '1.0', 'my Database', 10485760);
    
    db.transaction(function (tx) 
    {
        //Creates The table
        tx.executeSql('create table if not exists costTbl (cost real);');
 //Redirects to main page
document.location = 'main.html';
    });
The above code runs fine as I am successfully redirected to my main page. Once I am redirected to this page, I would like to perform a series of queries with my database I am attempting to re-open the database so I use the code below...
 var db = null;
  db = openDatabase("myDB", '1.0', 'my Database', 10485760);
//Fails here // 
   
db.transaction(function (tx) 
            {
                //I perform a series of queries here.
                
                });
..but it fails at the mentioned point with a couple error messages. "Maximum Stack size has been reached" followed by "db is undefined object". 
 Is opening the db twice ( in two separate pages) an illegal action? I am not sure what the problem here is. I am building a widget and testing on the 9800 simulator for OS6  
Any help would be greatly appreciated. Thank you.

 

Contributor
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: html5 openDatabase() fails

Problem solved. Please disregard - issue was with the simulator. Re-downloaded the Torch simulator and it worked.

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: html5 openDatabase() fails

Just wanted to clarify that you resolved this issue by downloading a newer version of the BlackBerry 9800 Torch simulator (currently this is v6.0.0.246) rather than re-installing the same version?

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Contributor
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: html5 openDatabase() fails

Yes, I downloaded the newer version.