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

BlackBerry Widget Sample Code - Storing local data with Gears

by Retired on ‎04-30-2010 04:08 PM - edited on ‎01-19-2012 12:20 PM by Retired (5,736 Views)

Applies to

  • BlackBerry device software 5.0
  • BlackBerry smartphones
  • Gears





A full working sample that utilizes the SQLite® database using BlackBerry WebWorks applications.

Please click on the attachment below to download the sample code.


Update : Gears no longer supported.


As of BlackBerry 6, the Gears Web APIs have been deprecated in place of strong support for HTML5 storage API.


For BlackBerry device software 6 and higher, developers should store data for offline use using HTML5 local storage, or Web DB.

Developers can continue to use Gears for development of applications that run on OS 5.0, however are strongly encouraged to leverage the Gears to HTML5 JavaScript framework.  This framework allows developers to use HTML5 syntax in their applications, which is then translated into Gears APIs when run on OS 5.0 Smartphones.


by New Developer
‎06-17-2011 01:17 AM - edited ‎06-17-2011 01:20 AM

It looks like this sample has been modified. I am unable to compile as is.

There is no longer a 'content src' so I modified config.xml to point to index.htm.

I was then able to compile but got an error on adding an item to the list; javascript alert... TypeError: Result of expression '_db' [undefined] is not an object.

I interpret it as not having instantiated the database but have not yet been able to determine why. 

// action.js is referenced in the index.htm file, _db is declared globally, onload calls openDatabase(), openDatabase() should create the instance and assign it to _db

// I tried to add code to confirm database exists/is created but got same outcome


The end of the file also now references a non existent icon and a bogus license element.  The norm seemed to be a basic 'as is' or  apache (not license.com)

Users Online
Currently online: 31 members 2,392 guests
Please welcome our newest community members: