Skip to main content

Posts

Showing posts from June, 2020

How to configure H2 Database on Spring Boot projects

Hi there, these are my notes taken from hyperskill.org (the official Jetbrains academy) web site.

1) Why use H2 as a database

H2 is an open-source lightweight relational database for the Java platform. It is provided by Spring Boot by default and is easy and quick to set up in comparison with other databases. Using H2 as a database in training projects can help you to concentrate on learning Spring Boot and java features instead of database-specific setup.
However, it also requires a minimal configuration to be done. The config you will create in this topic can then be simply reused in other studying projects with slight changes.
There are two main ways to store data in the H2 database. You can use it as an in-memory database and keep your data in memory while H2 is running. After you stop using H2 or the application, all the data will be lost.
The other way is to store the data on your drive at the file system and reuse it when you need it. We will use…