H2 Database - Installation

H2 is a database written in Java. We can easily embed this database in our application using JDBC. We can run this on many different platforms or any version of the Java Runtime Environment. However, Java must be installed on the system before the database can be installed.
Check your Java installation
If the JDK is installed on the system, try the following command to check the Java version.
java-version
If JDk is successfully installed on the system, we will get the following output.
java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
If the JDK is not installed on the system, please follow the link below to install the JDK .
Install H2 database
We can run this database on different platforms. In this chapter, we will learn about H2 database installation on Windows.
Following are the instructions for installing the H2 database on the Windows operating system.
Step 1: Download the H2 setup file
Download the latest H2 database from the provided link. From this link you will get the latest H2 database in two types. One is a Windows Installer type (that is, an .exe file) and the other is a platform-independent zip file for other operating systems.
Click the Windows installer to download the Windows supported H2 database after downloading the .exe file. In this case, we are using an H2 database with version 1.4.192.
Step 2: Install the H2 database
After downloading, we get the H2 setup file for Windows (i.e. h2-setup-yyyy-mm-dd.exe) in the Downloads directory. To start the H2 database installation process, double click on the installer file.
The next screen is the first step in the installation process. Specify the path where we want to install the H2 database server as shown in the following screenshot.
As seen in the above screenshot, by default it will use C:\ProgramFiles(x86)\H2 as the destination folder. Click "Next" to proceed to the next step. The following screen will appear.
In the above screenshot, click on the "Install" button to start the installation process. After installation, we get the following screenshot.
Click Finish to complete the installation process.
Step 3: Check the installation of the H2 database
After installation, let's check the installation of the database on the system. Click Windows → type H2 Console → Click the H2 console icon. Connect to the URL http://localhost:8082 . During the connection, the H2 database will ask you to register the database as shown in the following screenshot.
Fill in all the details in the above dialog such as saved settings, settings name, driver class, JDBC URL, username and password. In the JDBC URL, specify the location of the database and the name of the database. Username and Password are fields for the database username and password. Click Connect.
The database welcome page appears as shown in the following screenshot.