Setting up a MariaDB database
Now, we will switch our database from H2 to MariaDB. In this book, we are using MariaDB version 10. The database tables are still created automatically by JPA. However, before we run our application, we have to create a database for it. In this section, we will be using the one-to-many relationship from the previous section.The database can be created by using HeidiSQL (or DBeaver, if you are using Linux or macOS) Open HeidiSQL and follow these steps:
- Activate the top database connection name (Unamed) and right-click inside the database list.
Then, select Create new | Database:
Let's name our database
cardb
. After clickingOK
, you should see the newcardb
database in the database list:- In Spring Boot, add a MariaDB Java client dependency to the
build.gradle
file and remove the H2 dependency since we don't need it anymore. Remember to refresh your Gradle project after...