Introduction to five most popular embedded databases for mobile development
Embedded databases are lightweight and independent databases with no server components and no management required. They have a small code size and limited resource requirements. There are currently several types of embedded databases that you can use in mobile applications. Let's take a look at these most popular databases.
Database |
Data Type Storage |
License |
Supported platforms |
BerkeleyDB |
Relational, objects, key-value pairs, documents |
AGPL 3.0 |
Android, iOS |
Couchbase Lite |
Documents |
In Apache 2.0 |
Android, iOS |
LevelDB |
Key-value pairs |
New BSD |
Android, iOS |
SQLite |
Relational |
Public Domain |
Android, iOS, Windows Phone, and Blackberry |
UnQLite |
Key-value pairs, documents |
BSD 2-Clause |
Android, iOS, and Windows Phone |
Berkeley DB
Berkeley DB is an open-source embedded database management system developed by Sleepycat Software. It has been acquired by Oracle ), it provides scalable, high-performance, and transaction-protected data management services for applications.
Berkeley DBBDB is an efficient embedded database programming library. C, C ++, Java, Perl, Python, Tcl, and many other languages have their own APIs. Berkeley DB can store any type of Key/Value Pair), and can store multiple data for one Key. Berkeley DB allows thousands of concurrent threads to operate databases simultaneously and supports up to TB of data. It is widely used in various operating systems, these include most Unix-like operating systems, Windows operating systems, and real-time operating systems.
Couchbase Lite
Couchbase Lite is a lightweight, reliable, and secure JSON database developed for online and offline mobile applications. Even with the most uncertain network conditions, you can provide a fruitful and reliable reputation for your mobile applications. In addition, the 'synchronize portals 'function can also provide collaboration, social interaction, or user updates.
Highlights of Couchbase mobile platform
JSON Anywhere
Use a flexible data model designed for Object-Oriented mobile applications to instantly adapt to your application needs without significantly modifying the application.
Easy synchronization and easy synchronization)
Only a few lines of code are required for synchronization. developers can focus more on application development rather than synchronization issues.
Native APIs
Use APIs specially optimized for iOS and Android to manage mobile Databases
REST APIs
Based on your development needs, REST APIs provides an alternative access method.
LevelDB
LevelDB is a Key/Value storage engine open-source by Google. It is written in C ++ and supports High-concurrency access and writing. It is especially suitable for high-write business environments. For an overview of LevelDB, refer to data analysis and processing 2leveldb implementation principle) to describe Leveldb. The illustration in this article is more about the entanglement of an Implementation Layer of LevelDB, the version is LevelDB 1.7.02.
LevelDB storage is mainly divided into SSTable and MemTable. The former is immutable and stored on persistent devices, and the latter is in memory and variable (there are two memtables in LevelDB, one is currently written into MemTable, the other is an immutable MemTable waiting for persistence ). First, let's look at the Implementation Layer Analysis of SSTable.
SQLite
SQLite is an open-source embedded Relational Database Engine for SQL database with self-contained, zero configuration, and transaction support. It is highly portable, easy to use, compact, efficient, and reliable. Unlike other database management systems, SQLite is easy to install and run. In most cases, you can create, connect to, and use a database by ensuring that the binary file of SQLite exists. If you are looking for an embedded database project or solution, SQLite is definitely worth considering.
UnQLite
UnQLite is an embedded C language software library developed by Symisc Systems. It implements a self-contained, serverless, zero-configuration, and transactional NoSQL database engine. UnQLite is a document storage database, similar to MongoDB, Redis, CouchDB, and so on. It is also a standard Key/Value storage, similar to BerkeleyDB and LevelDB.
UnQLite is an embedded NoSQL key/value storage and document storage database engine. Unlike most other NoSQL databases, UnQLite does not have an independent server process. UnQLite directly reads/writes common disk files. A complete database containing multiple datasets is stored in a single disk file. The database file format is cross-platform. A database can be freely copied between 32-bit and 64-bit systems or between large-end and small-end architectures. The main features of UnQLite are as follows:
You can learn more details on the features page of UnQLite. (Think about it: what is SQLite like ?)
UnQLite is a self-contained C library without external dependencies. It requires a very small external library or support from the operating system. It is especially suitable for embedded devices and for computers that need to run on a large number of computers within an application without modifying configurations ).
UnQLite is, 100% manual encoding, uses ansi c, thread security, completely reentrant, compilation does not need to be modified, and can run on the vast majority of platforms, including limited embedded devices, only one C compiler is required. UnQLite has been tested on a wide range of platforms, including Windows and UNIX systems, especially Linux, FreeBSD, Oracle Solaris, and Mac OS X.
UnQLite is a standard key/value storage, similar to BerkeleyDB and LevelDB. However, it has a richer set of features, including support for ACID transactions and concurrent reads. In KV storage, keys and values are regarded as simple byte arrays, so the content can be anything, including ASCII strings, binary objects, and disk files. You can use API to access the KV layer, including
- unqlite_kv_store()
- unqlite_kv_append()
- unqlite_kv_fetch_callback()
- unqlite_kv_append_fmt()
- unqlite_kv_delete()
And so on.
UnQLite is used to store JSON documents such as objects, arrays, and strings in the database. It is supported/implemented through Jx9 programming language. Jx9 is an embedded scripting language, also called an extension language. It is designed for general procedural programming and has the characteristics of data expression. Jx9 is a Turing-Complete. It is a JSON-based Dynamic Programming Language and exists as a library of the UnQLite kernel.
In short, UnQLite is an open source software that is open to source code under the 2-Clause BSD Protocol.