Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

H2 Database Engine

Introduction
H2 is a relational database management system written in
Java. It can be embedded in Java applications or run in
client-server mode.

Initial release : December 2005; 17 years ago


Stable release : 2.1.210 / January 17, 2022
Operating system : Cross-platform
Website : h2database.com
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.

The name H2 stands for Hypersonic 2,


however H2 Does not share code with
Hypersonic SQL or HSQLDB.

H2 is built from scratch.


Very fast database engine The PostgreSQL ODBC
driver can be used
Open source

Written in Java
H2 DB
Multi version concurrency
Features

Embedded and Server


Strong security features
mode, Clustering support
Connection
Modes

Server Mixed
Modes Modes

Embedded
Mode
Server Mode
When using the server mode, an application opens
a database remotely using the JDBC or ODBC
API.

Many applications can connect to the same


database at the same time, by connecting to this
server.

Internally, the server process opens the


database(s) in embedded mode.

The server mode is slower than the embedded


mode, because all data is transferred over TCP/IP
Embedded Mode

In embedded mode, an application opens a


database from within the same JVM using JDBC.

This is the fastest and easiest connection mode. 

 As in all modes, both persistent and in-memory


databases are supported.

There is no limit on the number of database open


concurrently, or on the number of open connections.
Mixed Mode

The mixed mode is a combination of


the embedded and the server mode.

The first application that connects to a


database does that in embedded
mode,
but also starts a server so that other
applications can concurrently access
the same data.
Java Database Connectivity with 5 Steps
There are 5 steps to connect any java
application with the database using JDBC.
These steps are as follows :

1.Register the Driver class

2.Create connection

3.Create statement

4.Execute queries

5.Close connection
Connection URL ‘s in H2 Data Base Engine
1. Connecting to an Embedded (Local) Database

jdbc:h2:[file:][<path>]<databaseName>

2.MySQL Compatibility Mode

jdbc:h2:~/test;MODE=MySQL;DATABASE_TO_LOWER=FALSE

3.Oracle Compatibility Mode

jdbc:h2:~/test;MODE=Oracle;
4.Server mode

jdbc:h2:tcp://localhost/[<path>]<databaseName>
G. Maheshwar
D.DurgaPrasad

You might also like