Setting up the H2 Database
Learn how to connect to the in-memory H2 database, create tables, and populate data.
We'll cover the following
In this lesson, we will set up the in-memory H2 database. Let’s have a look the required steps:
Configuring database connection
The in-memory database H2 has automatically been configured in our application. The URL of the database can be found from the console log. This value is randomly generated each time the server is restarted. To make the database URL a constant, we need to configure this in
application.properties
as follows:
Get hands-on with 1400+ tech skills courses.