8.1 Database and DBeaver Setup
We will learn how to connect a Relational Database Management System (RDBMS) to permanently store and manage data in a Spring Boot application.
RDBMS Selection (MySQL vs PostgreSQL)
The most widely used open-source RDBMS in practice are MySQL and PostgreSQL.
- MySQL (MariaDB): The most popular, lightweight, and fast. Often used in read-heavy services or high-traffic web services.
- PostgreSQL: Closer to standard SQL and strongly supports complex queries, data constraints, and JSON types. Highly preferred in modern enterprise environments.
In this course, we will choose either the universally used MySQL (or compatible MariaDB) or PostgreSQL and install it in our local environment (Docker recommended).
Quick Installation using Docker (e.g., MySQL)
docker run --name mysql-db -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=mydb -p 3306:3306 -d mysql:8.0
DBeaver Tool Setup
After installing the database, we use a database client tool to visually handle tables and data. DBeaver, which is free and supports various DB engines, is the most widely used.
- Download and Install DBeaver: Install the version suitable for your operating system from the official website.
- Create a New Connection: Click the plug icon at the top of the tool and select the installed DB (MySQL or PostgreSQL).
- Enter Connection Info:
- Host:
localhost, Port:3306(MySQL) or5432(PostgreSQL) - Database:
mydb(created above) - Enter Username / Password and verify with "Test Connection".
- Host:
Once the DB and tools are ready, you need to input the information so the application (Spring Boot) can connect to this database.