Skip to content

15. Appendices

15.1. The MySQL DBMS with Laragon

Chapters 10 and 11 of this document use the MySQL 8 DBMS. The easiest way to install it on Windows is to install Laragon, a portable development environment that includes MySQL, the graphical client HeidiSQL, a configured terminal, Apache, and PHP. The author also uses it for his PHP courses.

15.1.1. Installation

Laragon can be downloaded from https://laragon.org. The installation process is standard; you can keep the suggested installation folder ([C:\laragon]). Laragon provides MySQL 8 (the exact version depends on the Laragon version), with a [root] administrator account that has no password and a server listening on port 3306 on the local machine. This is the configuration assumed by the examples in the document, where the JDBC URLs are in the form:

jdbc:mysql://localhost:3306/dbarticles

with the username [root] and an empty password. If MySQL was installed differently, with a password for [root], you must update the examples accordingly ([.properties] files or constants at the top of the programs).

For a system without Laragon, you can also install MySQL Community Server from https://dev.mysql.com/downloads/mysql/, or its open-source derivative, MariaDB. However, the examples have only been tested with MySQL 8: the scripts in Chapter 10 use a collation specific to MySQL 8 ([utf8mb4_0900_ai_ci]), and with MariaDB, it would need to be adapted, as would the JDBC driver (MariaDB provides its own).

15.1.2. Starting and Stopping MySQL

The Laragon main window includes a “Start All” button that starts the servers (Apache and MySQL) and a “Stop” button that stops them. MySQL is not a Windows service that runs at system startup: it only runs when started from Laragon, which prevents it from consuming resources when not in use. The Laragon menu (right-click in the window) also allows you to start only MySQL and to select its version.

When MySQL is not running, the programs in Chapters 10 and 11 fail with an exception from the JDBC driver indicating that no connection could be established ([CommunicationsException]: “Communications link failure”): this is the first thing to check in case of an error.

15.1.3. The command-line client

The Terminal button in Laragon opens a terminal where Laragon commands are available, including the command-line client MySQL ([mysql]). To connect to the server, use:

> mysql -u root

then enter SQL commands ending with a semicolon ([show databases;], [use dbarticles;], [select * from articles;]) and [exit] to exit. The client can also run a script SQL, which is what Chapter 10 does to create its databases:

1
2
3
> cd java-oct-2026\10-jdbc\sql
> mysql -u root < dbarticles.sql
> mysql -u root < dbtaxes.sql

The scripts completely recreate their database each time they are run: you can rerun them to restore the data to its initial state after testing.

15.1.4. The HeidiSQL graphical client

The Laragon Database button launches the graphical client HeidiSQL. Upon first launch, HeidiSQL offers a connection session that is already configured for the Laragon server MySQL (host [127.0.0.1], user [root], blank password, port 3306); simply open it. You will see:

  • on the left, the tree view of the server’s databases and their tables;
  • on the right, tabs showing a table’s structure, its data (which can be edited directly), and a field for entering SQL queries (the “Query” tab), which are executed by [F9].

To create a database using a script from Chapter 10, open the script (via the “File” menu, using the command to load an SQL file) in a query tab, then execute it ([F9]). You can also create a database, a user, and user permissions using the menus in HeidiSQL (right-click on the connection / “Create New” / "Database"; "Tools" menu / "User Manager"), but the SQL scripts have the advantage of being reproducible and able to be rerun.

IDEs can also connect to a database: IntelliJ IDEA via its “Database” window, VS Code via an extension such as “SQLTools” or “MySQL.”

15.1.5. The Databases in This Document

Chapters 10 and 11 use the following databases, all located on the local MySQL server:

Database
Chapter
Creation
[dbarticles]
10
Script [10-jdbc/sql/dbarticles.sql]: Table [articles] from the JDBC examples
[dbtaxes]
10
script [10-jdbc/sql/dbtaxes.sql]: the [brackets] table from version 6 of the [Tax] application and the [admtaxes] user
[hbfirst], [hbarticles], [hbshop], [hbclients], [hbconcurrency]
11
created by the programs themselves (option [createDatabaseIfNotExist=true] of the JDBC URL; tables created by Hibernate or by versioned scripts)
[hbtaxes]
11
Created and populated by the [CreateDatabase] program in version 7 of the [Tax] application

Once testing is complete, a database can be deleted using the command SQL [drop database name;], in the [mysql] client, or in HeidiSQL.

15.2. Maven Dependencies Used

The following table summarizes the libraries used by the Maven projects in this document, along with the versions with which the examples were tested. They are automatically downloaded from Maven Central by the [mvn] command (or by the IDE command) when a project is built for the first time, along with the libraries on which they depend: Internet access is therefore required at that time.

Library (groupId:artifactId)
Version
Chapters
[tools.jackson.core:jackson-databind] (Jackson 3)
3.1.5
5, 6, 12, 13
[org.junit.jupiter:junit-jupiter] (JUnit 6)
6.0.3
6, 10
[org.springframework:spring-context] (Spring Framework)
7.0.9
6, 10, 11, 12
[org.springframework:spring-orm]
7.0.9
11
[com.mysql:mysql-connector-j] (MySQL JDBC driver)
9.7.0
10, 11
[com.zaxxer:HikariCP] (connection pool)
7.0.2
10, 11
[ch.qos.logback:logback-classic] (logging)
1.5.38
10, 11
[org.hibernate.orm:hibernate-core] (Hibernate ORM)
7.4.5.Final
11
[org.eclipse.angus:angus-mail] (Jakarta Mail)
2.0.3
12
[org.springframework.boot:spring-boot-starter-parent] and [spring-boot-starter-webmvc] (Spring Boot)
4.1.1
13

The Maven plugins used are [maven-compiler-plugin] 3.15.0, [maven-surefire-plugin] 3.5.6 (test execution), [exec-maven-plugin] 3.5.1 ([mvn exec:java]), and [spring-boot-maven-plugin] 4.1.1 ([mvn spring-boot:run]). The projects in the [Tax] application for Chapters 10 through 13 also depend on the modules [examples.tax:tax-dao], [tax-business], and [tax-ui] (version 5.0), which must be installed in the local repository using the command [mvn install] entered in the [06-architectures/TaxV5] folder (Chapter 6).