H2 Database

Open source

H2 is a fast, embeddable SQL database written in pure Java, with JDBC access, in-memory or disk storage, encryption and a browser-based console.

Open-source alternative to

h2database.com
H2 Database homepage screenshot
GitHub stars
4.6k
Last 30 days
+11(+0%)
Last commit
yesterday
Repository age
11 years
Version
version-2.5.252
Licence
Custom
Self-hosted
Yes

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 tools
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 is H2 Database an alternative to?
H2 Database is an open-source alternative to Oracle Database. Other open-source alternatives to Oracle Database include PostgreSQL, ClickHouse and TimescaleDB.
Is H2 Database actively maintained?
Yes. The most recent commit to H2 Database was on 12 November 2026. The project has 4.6k stars on GitHub, with 11 added in the last 30 days.

Open-source alternatives to H2 Database

See all

SaaS alternatives to H2 Database

See all