Persistentdata for beginners: DBMS

The DBMS database engine was originally developed for portable computing devices in 1995.

Designed with a small footprint in mind, it provides support for multiple database tables, transactions, shared concurrent access, SQL and C++ APIs. DBMS has limited functionality compared with “traditional” relational databases, but has good performance and efficient resource usage.

It is used to store a variety of application and system data on the Symbian platform – contacts, log events, RSS subscriptions, Bluetooth settings and so on.

DBMS can be used in two configurations: either as a client-server (shared) database or as a library linked against the application in the same process (private to the application).

The DBMS API

The DBMS API is powerful, but quite large. Here’s a summary of what the classes are for:

API Purpose
CDbColSet A set of column definitions for a table or rowset
CDbKey Specifies a database table index
CDbNames A collection of names returned by the DBMS API (used for database, table, and index names)
CDbStrings A collection of strings passed from DBMS server to the client
RDbColReadStream Stream class to allow column values to be read as stream data
RDbColWriteStream Stream class to allow a long column to be streamed when inserting or updating rows in a rowset
RDbDatabase Abstract class providing the functionality of a database
RDbHandle<T> Internal class used by the DBMS implementation
RDbHandleBase Internal class used by the DBMS implementation
RDbIncremental Interface for performing long-running database operations in incremental steps
RDbNamedDatabase Generic database implementation. Provides a concrete implementation of RDbDatabase
RDbNotifier Provides notification of database changes to clients
RDbRowConstraint Represents a pre-compiled SQL search-condition
RDbRowSet Abstract base class providing cursor navigation, row retrieval and update behaviour of rowsets
RDbs DBMS server session handle
RDbStoreDatabase Store database implementation. Provides a concrete implementation of RDbDatabase
RDbTable Provides access to table data as a rowset
RDbUpdate Incremental interface to execute SQL data update
RDbView Generates rowsets from an SQL query
TDbBookmark Records the current position in a rowset
TDbBookmark::TMark Stores a database bookmark
TDbCol Defines a column in a table or rowset
TDbColSetIter Iterator for a column set
TDbKeyCol Defines a key column in an index
TDbLookupKey Internal class used by the DBMS implementation
TDbLookupKey::SColumn Internal class used by the DBMS implementation
TDbQuery A SQL query combined with a text comparison mode
TDbSeekKey Database key value
TDbSeekMultiKey<S> Database multi-column key value
TDbWindow Specifies the level of pre-evaluation for SQL query execution
RDbDatabase::TSize Encapsulates database size and usage metrics

Further resources

  • Symbian^3 reference documentation for DBMS
  • An article about DBMS from Dr Dobb’s Journal, Symbian Database Components: A small footprint DBMS for small footprint devices, written by Regan Coleman in 1996
  • A guide from Forum Nokia (S60 Platform: Using DBMS APIs v2.0) that demonstrates how to use the API with a simple example
  • Coming up next…
    The next part of the Persistentdata for beginners series will cover Symbian SQL, the client–server database incorporating SQLite.

    Advertisements

    4 Responses to “Persistentdata for beginners: DBMS”

    1. Sebastian Brannstrom Says:

      In my experience DBMS is not particularly fast compared to SQLite. Why is this? Is it just poor usage from my side?

      • cdudding Says:

        DBMS and SQLite have very different architectures and storage mechanisms.

        SQLite (and Symbian SQL) has much better performance for record lookup without indexes probably due to the page-based record structure of SQLite and a different interaction with the file system (number of I/O reads to fetch record data).

        We carried out some benchmarking in 2007 for SymbianOS v9.3 comparing the first delivery of Symbian SQL and DBMS where we found that the performance of SQL’s full table scan was 3.6 times that of the DBMS full table scan for a particular data set.

        For searches with an index, SQLite has an advantage of a built in unique integer index (http://www.sqlite.org/autoinc.html) that provides significant advantages compared to DBMS.

        With recent optimisations made to Symbian SQL, I would expect Symbian SQL to outperform DBMS for most use cases. That said, DBMS is still valuable, is widely used throughout the platform and can offer good performance for smaller datasets.

        Sebastian: Were you asking about a particular type of database operation, or just commenting in general?

    2. Sebastian Brannstrom Says:

      It was just a general comment. I found DBMS to be very clunky when I tried to use it.

      Does it have a usage scenario for future apps, or is it just there for legacy reasons? I.e. is there an application where DBMS would be preferable to SQlite?

      • cdudding Says:

        That’s an excellent question, and a good subject for a future post.

        There is one area where DBMS has superior functionality to Symbian SQL, which is the availability of change notification for shared databases. I created bug 315 to track this gap. It is not currently planned on the persistentdata backlog. If any community members are interested to contribute or help deliver this feature, please let me know.

        I think DBMS may have better performance for one or two specific operations suited to its architecture and persistence model. For example insertion of a single record into a single table database containing a low cardinality of records. I don’t have any recent measurements to back this up though.

        I would like to have a guide to help people select the most appropriate persistence mechanism for their application. However, this will need some time to create. In the interim, I suggest new database users to look at Symbian SQL and QtSQL first.

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s


    %d bloggers like this: