H2 is a
relational database management system
A relational database (RDB) is a database based on the relational model of data, as proposed by E. F. Codd in 1970.
A Relational Database Management System (RDBMS) is a type of database management system that stores data in a structured for ...
written in
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
. It can used as an
embedded database in Java applications or run in client–server mode.
The software is available as
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
software
Mozilla Public License
The Mozilla Public License (MPL) is a free and open-source weak copyleft license for most Mozilla Foundation software such as Firefox and Thunderbird. The MPL is developed and maintained by Mozilla, which seeks to balance the concerns of bo ...
2.0 or the original
Eclipse Public License.
History
The development of the H2 database engine started in May 2004, and first published in December 2005. The database engine was written by Thomas Mueller. He also developed the Java database engine Hypersonic SQL. In 2001, the Hypersonic SQL project was stopped, and the
HSQLDB Group was formed to continue work on the Hypersonic SQL code. The name H2 stands for Hypersonic 2, however H2 does not share code with Hypersonic SQL or HSQLDB. H2 is built from scratch.
Version 2.0.x was released in January 2022.
Features
A subset of the
SQL (Structured Query Language) standard is supported. The main programming APIs are SQL and
JDBC
Java Database Connectivity (JDBC) is an application programming interface (API) for the Java (programming language), Java programming language which defines how a client may access a database. It is a Java-based data access technology used for Java ...
, however the database also supports using the
PostgreSQL
PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
ODBC
In computing, Open Database Connectivity (ODBC) is a standard application programming interface (API) for accessing database management systems (DBMS). The designers of ODBC aimed to make it independent of database systems and operating systems. An ...
driver by acting like a PostgreSQL server.
It is possible to create both in-memory tables, as well as disk-based tables. Tables can be persistent or temporary. Index types are hash table and tree for in-memory tables, and
b-tree
In computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree generalizes the binary search tree, allowing fo ...
for disk-based tables. All data manipulation operations are
transactional. Table level locking and
multiversion concurrency control
Multiversion concurrency control (MCC or MVCC), is a non-locking concurrency control method commonly used by database management systems to provide concurrent access to the database and in programming languages to implement transactional memory.
...
are implemented. The
two-phase commit protocol
In transaction processing, databases, and computer networking, the two-phase commit protocol (2PC, ''tupac'') is a type of Atomic commit, atomic commitment protocol (ACP). It is a distributed algorithm that coordinates all the processes that pa ...
is supported as well, but no standard API for distributed transactions is implemented.
The security features of the database are:
role based access rights, encryption of the password using
SHA-256
SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compressi ...
and data using the
AES or the Tiny Encryption Algorithm,
XTEA. The cryptographic features are available as functions inside the database as well.
SSL /
TLS connections are supported in the client–server mode, as well as when using the console application.
The database supports protection against
SQL injection by enforcing the use of parameterized statements. In H2, this feature is called 'disabling literals'.
Two
full text search implementations are included, a native implementation and one using
Lucene.
A simple form of high availability is implemented: when used in the client–server mode, the database engine supports hot failover (this is commonly known as clustering). However, the clustering mode must be enabled manually after a failure.
Since version 1.1.111, H2
in-memory database can run inside the
Google App Engine.
See also
*
List of relational database management systems
*
Comparison of relational database management systems
*
Apache Derby
Apache Derby (previously distributed as IBM Cloudscape) is a relational database management system (RDBMS) developed by the Apache Software Foundation that can be embedded in Java programs and used for online transaction processing. It has a 3.5 ...
*
HSQLDB
References
External links
* {{Official website, www.h2database.com
Cross-platform free software
Embedded databases
Free computer libraries
Free database management systems
Java (programming language) libraries
Relational database management software for Linux
Relational database management systems
Serverless database management systems
Software using the Mozilla Public License