About H2 Database
H2 is a relational database management system written in Java. It can run embedded inside an application or as a standalone server, and databases can live on disk or purely in memory, which makes it popular for development, testing and small production uses where a full database server would be overkill.
Listed features include a JDBC API, transaction support with multi-version concurrency, a browser-based console application, encrypted databases and full-text search. It is pure Java with a small footprint, about 2.5 MB for the jar, and it also provides an ODBC driver. The project documents SQL commands, functions, aggregate and window functions and data types, and offers a tutorial, issue tracker and forum.
H2 is open source, with its license shown as 'Other' on GitHub, and is added to Java projects as a dependency, so no hosting is needed. It suits Java developers who want a lightweight database for unit tests, prototypes and embedded applications.
Key features
- Embedded and server modes
- In-memory or disk-based databases
- JDBC API and ODBC driver
- Transactions with multi-version concurrency
- Browser-based console application
- Encrypted databases and full-text search
Good fit for
- →Fast in-memory databases for tests
- →Embedded SQL storage in Java apps
- Built with
- Java
- Tags
- database
- java
- sql
- jdbc
- embedded-database
- in-memory
- rdbms
H2 Database: questions and answers
- What is H2 Database used for?
- H2 Database is a fast, embeddable SQL database written in pure Java, with JDBC access, in-memory or disk storage, encryption and a browser-based console. It is a good fit for fast in-memory databases for tests and embedded SQL storage in Java apps.
- Is H2 Database open source?
- Yes. H2 Database is open source under a custom licence. Its source code is on GitHub at h2database/h2database and is written mainly in Java.
- Is H2 Database free?
- Yes. H2 Database is open source, so the software itself is free to use under the terms of its own licence.
- Can I self-host H2 Database?
- Yes. H2 Database can be self-hosted on your own server or infrastructure; there is no official hosted version.
- What are some alternatives to H2 Database?
- Similar open-source tools in the Databases category include DuckDB, PostgreSQL and QuestDB. SaaS products in the same category include Amazon MemoryDB, Cloudflare D1 and Exasol.
- Is H2 Database actively maintained?
- Yes. The most recent commit to H2 Database was on 1 October 2026. The project has 4.6k stars on GitHub.
Open-source alternatives to H2 Database
See all
DuckDB
Databases
DuckDB is an analytical in-process SQL database management system
MITvs MotherDuck★ 42k
PostgreSQL
Databases
Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we d
OSSvs Oracle Database★ 22k
QuestDB
Databases
QuestDB is a high performance, open-source, time-series database
Apache-2.0vs Tinybird★ 17k
Apache Ignite
Databases
Apache Ignite
Apache-2.0vs Aerospike★ 5.1k
OrientDB
Databases
OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Ge
Apache-2.0vs Amazon Neptune★ 5k
Redis
Databases
For developers, who are building real-time data-driven applications, Redis is the preferre
OSSvs Upstash★ 77k
SaaS alternatives to H2 Database
See all
Amazon MemoryDB
Databases
Durable in-memory database service on AWS compatible with Valkey and Redis OSS
SaaS
Cloudflare D1
Databases
Serverless SQLite-based database for Cloudflare Workers
SaaS
Exasol
Databases
In-memory analytics database for fast SQL queries on large datasets
SaaS
Oracle Database
Databases
Oracle relational database for enterprise transactional and analytical workloads
SaaS
Aerospike
Databases
Real-time NoSQL database for low-latency, high-throughput applications
SaaS
Amazon Athena
Databases
Serverless interactive query service for analyzing data in Amazon S3 with SQL
SaaS

