Mobile databases: SQLite and SQLite alternatives for Android and iOSUpdated comparison
Note: This is an updated version of an earlier Mobile Database Comparison.
What is a mobile database?
While Wikipedia defines a mobile database as “either a stationary database that can be connected to by a mobile computing device […] over a mobile network, or a database which is actually stored by the mobile device,” we solely refer to databases that run on the edge device itself. Therefore, we also refer to it as “on-device” database. An edge device may be any device from a sensor, to an IoT gateway, to a car, to a Raspberry Pi, to a mobile phone (smartphone) to an on-premise server. Typically, the challenge arises when running on the smaller, more restricted devices. Generally, any database can run on a big server or cloud infrastructure with unlimited resources, but only few fit on a Raspberry Pi Zero.
What are the advantages and disadvantages of working with SQLite?
SQLite is easily the most established edge database and probably the only “established” mobile database. SQLite has been around since the year 2000 and is embedded with iOS and Android since the beginning. SQLite is a relational database.
What are SQLite alternatives?
There are plenty of alternatives to working with SQLite directly. If you simply want to avoid writing lots of SQL and boilerplate code, you can use an object abstraction on top of SQLite. This abstraction layer is usually an ORM (object/relational mapper), e.g. greenDAO.
However, if you rather seek a complete replacement for SQLite, there are a few alternative databases: Couchbase Lite, Interbase, LevelDB, ObjectBox, Oracle Berkeley DB (formerly Oracle’s mobile database was “Oracle Database Lite”), Realm, SnappyDB, SQL Anywhere, and UnQLite.
Obviously, if your also looking for alternatives that are not on-device edge / mobile databases, there are a lot of cloud / server options out there that you can use as a replacement like e.g. Firebase. Though, with these your app will not work offline, response rates will be slower than with an on-device database and cannot be guaranteed, and last not least you will have much higher cloud costs.
To give you an overview, we have compiled a small comparison table:
|Name||Android / iOS||Type of data stored||Sync Central||Sync P2P||Data level encryption||License / business model||Short description||Minimum Footprint size||Company|
|Android / iOS||JSON Documents / NoSQL db||Yes||Yes||Database encryption with SQLCipher (256-bit AES)||Apache 2.0||Embedded / portable db with P2P and central synchronization (sync) support. Secure SSL.||Couchbase|
|Android / iOS||Key-value pairs / NoSQL db||No||No||No||Apache 2.0||Portable lightweight key-value store, NoSQL database.|
|Android / iOS||Relational||No||No||256bit AES strength encryption||Proprietary||Embeddable SQL database.||400 KB||Embarcadero|
|Android / iOS||Key-value pairs / NoSQL db||No||No||No||New BSD||Portable lightweight key-value store, NoSQL db, doesn't support indexes, very fast for some use cases; earlier available enchmarks from 2011 have been removed unfortunately.||350kB||LevelDB Team|
|Android / iOS||Objectoriented NoSQL database for high-perormance on edge devices in Mobile and IoT||Yes||In development||transport encryption; additional encryption upon request||Apache 2.0 and Proprietary||Embedded object-oriented NoSQL edge database with out-of-the-box synchronization; fully ACID compliant; optimized for speed restricted devices, benchmarks available.||< 1MB||ObjectBox|
|Android / iOS||Relational and Key-Value-Store||With Oracle Mobile Server||With Oracle Mobile Server||128-bit AES Standard encryption||Proprietary||Embedded / portable db with P2P and central sync support as well as support for sync with SQLite.||< 1MB||Oracle Corporation|
|Android||Key-value pairs / NoSQL db||No||No||No||Apache 2.0||Portable lightweight key-value store, NoSQL db based on LevelDB.||Nabil HACHICHA|
|Android / iOS||Object Database||No||No||Yes||Apache 2.0 License APIs with proprietary sync.||Embedded object db.||Realm Inc.|
|Android / iOS||Relational||Dependant||No||AES-FIPS cipher encryption for full database or selected tables||Proprietary||Embedded / portable db with central snyc support with a stationary database.||Database memory footprint: only 300KB for mobile devices||Sybase iAnywhere|
|embedded on iOS and Android||Relational||No||No||No, Use SQLCipher to encrypt SQLite||Public domain||C programming library; clear market leader).||500KiB||Hwaci|
|Android / iOS||Key-value pairs / document store / NoSQL db||No||No||2-Clause BSD||Portable lightweight embedded db; self-contained C library without dependency.||Symisc systems|
If you are interested in an indication of the diffusion rate of databases and mobile databases, check out the following database popularity ranking: http://db-engines.com/en/ran.
Thanks for reading and sharing. Please let us know what you’re missing.