The Oracle Lite Blog

The Rekounas Blog about Oracle's Mobile Enterprise Application Platform

The Oracle Lite Blog header image 2

Synchronizing with Berkeley DB

November 9th, 2010 · 6 Comments

Here is a quick overview for the Oracle Lite guys that are going to be or planning to move to Berkeley DB / SQLite API pretty soon.

There are plenty of options in Berkeley DB that make the the database more stable then Oracle Lite on the mobile device.

I was playing around with the Berkeley DB last night and here are some of the features I could see really useful that Oracle Lite does not have out of the box or at least you aren’t able to change the default option.

  • auto_vacuum – By turning on this option, basically it reduces the high watermark on the database when bulk of records are deleted. Oracle Lite has the use of the defrag tool, but that has to be run manually and it has to be provided to the users. It does not come built in. auto_vacuum has three modes: NONE, FULL, and INCREMENTAL. Read up on the auto_vacuum pragma here and the VACUUM statement here. Note that auto_vacuum does not defrag the database, but it can fragment it more. VACUUM command is the defrag option.
  • journal_mode – Journal mode is the rollback segment of the database. I am not going to repeat all of the 6 modes but here is a quick highlight: OFF, DELETE, TRUNCATE, PERSIST, MEMORY, and WAL (Write-ahead-log). For users in a synchronization environment, the following may be your best options in the following order MEMORY, TRUNCATE, and DELETE (Normal Mode). Since most of your data is stored on the server, it is probably safe to use a rollback segment that is in volatile memory. Read more about the journal_mode here.
  • synchronous – There are three modes here; FULL, NORMAL, and OFF. The default is FULL. What this pragma does is check the database on occasion to ensure that information is written to disk. So if your system crashes, you will be relatively safe from a corrupt database. Now with the mobile server, you always have a backup of your data on the server, so even if your client database becomes corrupt, completely refreshing the clients isn’t a problem. They will lose the data the was updated since the last sync. So, the damage is minimal. Knowing this, you can decide how synchronous you want your client database to be. By turning off the synchronous mode, some operations can improve by 50x. Something to consider.
  • As I get myself a little more familiar with Berkeley DB, I hope to have some more Do’s and Don’ts posted.


Tags: Berkeley DB · Oracle Lite · SQLite

6 responses so far ↓

  • 1 Christian Leins wrote on Dec 1, 2010 at 7:40 am

    Hi Greg,
    Did I understand correctly that the mobile database including the mobileclient app will be replaced by the Berkeley product?
    Will this new client db support all mobile server versions?
    Does it support ODBC as the old OLDB?
    Thanks a lot for a short reply.
    Best Regards

  • 2 rekounas wrote on Dec 1, 2010 at 9:28 am

    Hi Christian,

    The mobile client will remain the same. Oracle Lite and Webtogo (Client) will be in maintenance mode. I know a lot of people interchange Webtogo to mean the Server and the Client and I think that is where there is some confusion. Basically, Oracle Lite will be replaced by SQLite… SQLite can be replaced by Oracle Berkeley DB for improved performance. SQLIte and DBD both support ODBC, ADO, and JDBC. I should probably start writing a white paper on the various migrations, but I have been busy lately and haven’t got around to it.



  • 3 gladson wrote on Mar 7, 2011 at 6:34 am

    Hi Rekounas,

    When I configure the ODBC connection for Berkeley DB, which driver I need to use

    Do I need to select this db-journal directory as the path, would you mind just give me some steps to create a ODBC connection for BDB.

    Using this connection with oracle mobile server (i have installed) I need to sync with Oracle database.


  • 4 rekounas wrote on Mar 7, 2011 at 6:57 am

    Here is the driver that you need…

    Think of the SQL flavour of BDB like SQLite. All the resources that work for SQLite will work for Berkeley DB.

  • 5 Rajesh Rajagopalan wrote on Jun 17, 2011 at 7:33 am

    Hi Rekounas

    For SQL Lite or Berkley DB on Android, where can I download the Oracle Lite Sync Client?


  • 6 rekounas wrote on Jun 17, 2011 at 9:09 am

    Hi Rajesh,

    You have to download and install the Oracle Mobile Server. The mobile server will deploy the mobile database. I will look around for a tutorial, there should be one in the mobile server documents though when you install it.

Leave a Comment