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
New Developer
pworswick
Posts: 7
Registered: ‎12-30-2009
My Carrier: Digicel

Using the Database API

After reading the article here

http://www.blackberry.com/developers/docs/webworks/api/Database.html

 

Was trying to do an example so added the command

 

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

 

However in my emulator (Blackberry 9700 simulator), i get the error

 

ReferenceError: "openDatabase" is not defined.
    Running  at line    8: db=openDatabase("Customer","1.0","Offline document storage",5*1024*1024,null);}.
    Called from line    1: synchronize();} } } }.


Is this only supported on Playbooks ? Wrong SDK version ?

Please use plain text.
New Developer
pworswick
Posts: 7
Registered: ‎12-30-2009
My Carrier: Digicel

Re: Using the Database API

[ Edited ]

Sorry found the solution

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/OS5-HTML5-to-Gears-openDatabase-...

 

And to add, there's a way in the emulator to mount the SD card automatically.

Edit the 9700.bat file

and add the item "/sdcard-inserted " to the end of the command line. Specific options avaialble by typing

fledge /help in whatever folder fledge is in. (SD card size, specific directory, etc)

 

However I have tried different code and haven't got it to work. What am I doing wrong ? Is it a particular emulator I am supposed to use ? Tried 9700 and 8350. Presently using Webworks Plug in version 2.5.1.201010291444-2

and Blackberry webwork SDK plug-in 1.5.1.201010291444-22 and getting the error OpenDatabase is not defined.

 

Please use plain text.
Regular Contributor
genvej
Posts: 58
Registered: ‎01-19-2011
My Carrier: vodafone

Re: Using the Database API

It seems that your method opendatabase is not being recognized. Most likely it is because you havent included the proper html5.js like this

 

<scriptsrc="js/html5_init.js"type="text/javascript"id="html5_init"></script>

 

Are you using visual studio?? In that case I would recommend you to manually install the latest webworks 2.1 as the one you are using in the plugin is older. I actually think that by installing 2.1 you will have the html5_init as an embedded ressource, hence not needing the above. Try it out and let me know about your progress

Please use plain text.
New Developer
pworswick
Posts: 7
Registered: ‎12-30-2009
My Carrier: Digicel

Re: Using the Database API

That seems to work well, thank you. Not using visual studio but eclipse. Tried installing the 2.1.1 but did not seem to install in the correct location. However the database API seems to work. Presently getting sqlite missing database error. Any suggestions ?
Please use plain text.
Regular Contributor
genvej
Posts: 58
Registered: ‎01-19-2011
My Carrier: vodafone

Re: Using the Database API

[ Edited ]

Make sure the SDCard is inserted... Otherwise I suggest you download some of the samplecodes around. Should work flawlessly :-)

Please use plain text.