H2 database is an open source Java database. We often use the H2 database for testing purposes with its in-memory database feature. In addition, H2 database can also be installed to use as a normal database. In this tutorial, I will guide you how to install your H2 database.
First, you need to go to the download page of the H2 database at http://www.h2database.com/html/download.html to download the installation file. H2 database has 2 versions:
- An installable version for Window: Window Installer
- And a version for any operating system that has Java installed is: Platform-Independent Zip
I’m currently using macOS so I’m going to download the Platform-Independent Zip version.
After downloading, please unzip the downloaded file, the results are as follows:
Open the Terminal or Console and go to the /bin directory of h2, then execute the following command to start the H2 database server:
At this point, a new URL of the form http://10.2.0.100:8082/login.jsp?jsessionid=d5ea2e777c66d96820c4fc778c590414 will be opened in your browser:
Information about Driver class “org.h2.Driver”, JDBC URL with database “test”, User Name “sa”, blank password of H2 database already installed. You do not need to change anything, just hit the Connect button only.
Then, you will see the results as follows:
So, we have successfully installed H2 database.