Skip to content

Research and decide database library

Could be a sqlite wrapper library (with encryption ideally).

Extensions

Name URL & Summary Encryption Platforms Notes
SQLCipher https://www.zetetic.net/sqlcipher/ yes Android depends on androidx.sqlite:sqlite. Using this library "would probably require forking sqlite-jdbc and adapting it to work with SQLCipher rather than plain SQLite"
SQLCipher is an open source library that provides transparent, secure 256-bit AES encryption of SQLite database files. While the Android AAR package is available for free, the JDBC driver for the JVM is only available in the Enterprise plan from Zetetic
SQLite Multiple Ciphers https://github.com/utelle/SQLite3MultipleCiphers https://utelle.github.io/SQLite3MultipleCiphers/ yes C This project is Work In Progress. As of May 2021, the code base is now rather stable, however, further major code modifications and/or reorganizations may still occur.
The project SQLite3 Multiple Ciphers implements an encryption extension for SQLite with support for multiple ciphers. In the past the encryption extension was bundled with the project wxSQLite3, which provides a thin SQLite3 database wrapper for wxWidgets.
SQLite JDBC Crypt https://github.com/Willena/sqlite-jdbc-crypt yes Android+JVM via bundled native code (Utelle) Based on SQLite Multiple Ciphers (see row above)
SQLite JDBC is a library for accessing and creating SQLite database files in Java. Looks promising. Got it to work on Linux without problems; got it to work on Android, too, but not directly because the native code bundled in the JAR is not accessible on Android with the approach of native library loading they use and even when the *.so files are copied into the project, they do not work because the seem to compiled for glibc not musl. Still, got it working by copying Java and native code into the project and compiling using NDK. Will probably require some work to get this to work properly. We can try compiling the native code ourselves as we do with Tor. Also it would be possible to create AAR packages from an android-library project.
SQLeet https://github.com/resilar/sqleet yes C "sqleet does not have an out-of-the-box support for Android. However, SQLite Android Bindings project provides an easy way to bundle a custom SQLite3 version (such as sqleet) into an Android application with the standard Android interface android.database.sqlite." We would still need a way to have a unified JVM/Android interface. In combination with SQLDroid (see below) we could potentially use this using a unified JDBC API, however we'd also need a JVM JDBC driver that uses SQLeet for which support is not mentioned on the project page
sqleet is an encryption extension for SQLite3. The encryption is transparent (on-the-fly) and based on modern cryptographic algorithms designed for high performance in software and robust side-channel resistance. The compilation of sqleet is easy because there are no external dependencies, which simplifies cross-compiling and cross-platform development.

Drivers

Name URL & Summary Encryption Platforms Notes
SQLite JDBC https://github.com/xerial/sqlite-jdbc no JVM
JDBC driver for SQLite using JNA instead of JNI to make it easy to deploy (if you already have SQLite installed). (…) The main goal of this library is to allow users to encrypt databases they are producing
SQLite JNA https://github.com/gwenn/sqlite-jna no
SQLDroid https://github.com/SQLDroid/SQLDroid no Probably makes it possible to use the same DB code for JavaSE and Android as both can then rely on JDBC. Be wary: https://stackoverflow.com/a/55567547
SQLDroid is a JDBC driver for Android's sqlite database (android.database.sqlite.SQLiteDatabase)

Abstractions

Name URL & Summary Encryption Platforms Notes
SQLDelight https://github.com/cashapp/sqldelight no Kotlin Has Android drivers based on androidx.sqlite and JVM drivers based on xerial's JDBC drivers
SQLDelight generates typesafe kotlin APIs from your SQL statements. It verifies your schema, statements, and migrations at compile-time and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple.

Pure Java

Name URL & Summary Encryption Platforms Notes
H2 http://www.h2database.com/ yes JVM
HSQLDB http://www.hsqldb.org/ yes JVM
Apache Derby http://db.apache.org/derby/ yes JVM
SQLJet https://sqljet.com/ no JVM
SQLJet is an independent pure Java implementation of a popular SQLite database management system. SQLJet is a software library that provides API that enables Java application to read and modify SQLite databases. SQLJet does not support SQL queries; there is an API to work with the database on a lower level.

Pure Java Non-SQL

Name URL & Summary Encryption Platforms Notes
Berkeley DB Java Edition https://docs.oracle.com/cd/E17277_02/html/index.html
JE is a general-purpose, transaction-protected, embedded database written in 100% Java (JE makes no JNI calls). As such, it offers the Java developer safe and efficient in-process storage and management of arbitrary data.
Berkeley DB Direct Persistence Layer https://docs.oracle.com/cd/E17277_02/html/java/index.html?com/sleepycat/persist/package-summary.html
The Direct Persistence Layer (DPL) adds a persistent object model to the Berkeley DB transactional engine.
Perst https://www.mcobject.com/perst/
Edited by Sebastian