Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Data storage APIs

There are several ways you can store, share, and manage data for your apps:

  • File system: Store data in files and folders using the FileConnection API
  • SQLite database: Store data in relational databases using the Database API
  • Persistent store: Save objects across smartphone restarts using the PersistentStore API
  • Runtime store: Save objects nonpersistently, which is useful for sharing data between applications and creating system-wide singletons, using the RuntimeStore API
  • Record store: Store data in the MIDP Record Management System using the RMS API

The following table compares the features of each approach:

Features

File system

SQLite database

Persistent store

Runtime store

Record store

Data format

Any

Relational database file

Java object

Java object

Serialized

Storage locations

Application storage, external media card, built-in media storage

External media card, built-in media storage

Application storage

Application storage

Application storage

Maximum storage limit

Size of partitions the user has access to

Size of partitions the user has access to

Available application storage

Available application storage

Differs according to BlackBerry Device Software version

BlackBerry Device Software support

4.2 or later (FileConnection API)

5.0 or later

All

3.6 or later

All

Persists across smartphone restarts

Yes

Yes

Yes

No

Yes

Applications can share data

Yes

Yes

Yes

Yes

Yes

Following are some considerations for choosing a data storage approach:

  • The file system and SQLite databases are typically the most efficient storage location for large, read-only files such as videos or large graphics.
  • Memory on wireless smartphones can be very limited, so you should consider not storing all data on the smartphone. BlackBerry smartphones are frequently connected so your application can access data when needed. In many cases, the best approach is to store data across smartphone restarts only for data that is frequently accessed.
  • When you consider where to store essential data, keep in mind that microSD cards can be removed.
  • There is more latency in writing to application storage than there is in reading from it. For example, reading from the persistent store is relatively fast while commits are relatively slow.
  • The file system and record store are standards-based approaches, while the persistent store and runtime store are specific to BlackBerry smartphones. If you want your application to run on other Java ME compatible devices, you should consider a standards-based approach.

More information about data storage