blob: 4dcf10e21a1ccb8577973a04900e8bbde87fa2fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# ADR: Use H2 database
Date: 2026-10-23
## Context
SQLite is the ideal choice for small services like webmention receivers, but in the Java ecosystem, the only production-ready SQLite JDBC is [`org.xerial/sqlite-jdbc`](https://github.com/xerial/sqlite-jdbc), which has its limitations.
`sqlite-jdbc` is **not truly cross-platform**. It is mostly written in C and compiled to `.so`. Then native libraries are bundled to `.jar` and called from Java. SQLite itself is super lightweight, but bundling native libraries of **every OS and arch** is extremely heavy. Plus, `sqlite-jdbc` does not support OpenBSD, NetBSD and many platforms. I had to manually compile C libraries for weepinbell to work on those platforms and it'll also make `.jar` much heavier.[^1]
It's safe to say that, at least for the time being, SQLite is not suitable for Java and Clojure.
## Decision
The closest thing to SQLite in Java/Clojure ecosystem is [H2](https://www.h2database.com/html/main.html). It's file-based, light-weight (~ 2.5 MB) and very fast.
It's also a SQL database, with some minor incompatibilties with SQLite (syntax-wise and feature-wise). Migrating from SQLite to H2 has very little cost.
The SQLite version was never released and shipped to users. The H2 version will replace SQLite in the `v1.0.0` release. Apart from the git history. It'll be like we never supported SQLite.
[^1]: Also see [ADR-0001](./0001-sqlite-jdbc-exclusions.md)
|