CNX Software – Embedded Systems News

Databases for Linux Embedded Systems: Berkeley DB and SQLite

Embedded systems often need to use database to store contact information, EPG data and more. Many Linux systems use MySQL, however such a large database management system may not always be appropriate for embedded systems.

Hence, there are lightweight database management systems  implementation that are especially suited to embedded systems by their binary footprint, memory footprint and CPU requirements.

If you want to develop in C in Linux and your requirement is to have no (or little) license to pay in your application, you could consider Oracle Berkeley DB or SQLite among others.

Oracle Berkeley DB (previously Sleepycat Berkeley DB)  is described as follows:

Berkeley DB enables the development of custom data management solutions, without the overhead traditionally associated with such custom projects. Berkeley DB provides a collection of well-proven building-block technologies that can be configured to address any application need from the hand-held device to the datacenter, from a local storage solution to a world-wide distributed one, from kilobytes to petabytes.

Berkeley DB has the following characteristics:

The latest stable version is  Berkeley DB 11gR2 (11.2.5.1.25).

SQLite is described as follows:

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

SQLite has the following features:

The latest version is SQLite 3.7.5.

Whether you choose one of the other you’ll have to consider:

  1. SQLite support SQL natively, has a low memory footprint (190KB minimal / 325 KB full features) and is open source (GPL License) . However, some extensions are not open source and require a license such as SQLite Encryption Extension. (2000 USD one-time fee payable to hwaci).
  2. Berkeley DB supports SQL thru SQLite, has a low memory footprint (350KB minimal config) a has a dual license GPL/Commercial. Berkeley also have a XML (C++) and Java Edition.

There are many parameters to consider, but generally, in most cases you would probably go with SQLite unless you need encryption, do not want to pay the 2000 USD  license fee and your code can be open-sourced. In the later case, Berkeley DB is probably the best choice.

In the next posts, I’ll explain how to cross-compile SQLite and Berkeley DB for ARM and MIPS targets.

Support CNX Software - Donate via PayPal, become a Patron on Patreon, or buy review samples