liveBook · Manning

Database connection health check

As explained in Quarkus in Action

A database connection health check determines whether an application's configured database connection is working.

A database connection health check verifies whether an application's configured JDBC connection is working. Quarkus automatically exposes this as a readiness check when the application uses a JDBC data source. section 10.2.1

Apply the check in a Quarkus service by:

  • Running the service and inspecting the Health UI or /q/health endpoint. section 10.2.1
  • Using /q/ready when only readiness checks are needed. section 10.2.1

Detecting an unavailable database

With the database running, the overall status and database check report UP. Stopping the MySQL container changes the overall status to DOWN and reports a communications-link failure.

How Quarkus in Action covers it

How deep it goes
Demonstrates extension setup, UI and endpoint inspection, and failure behavior, but does not implement the automatic check itself.
Examples
Uses an Inventory service, a MySQL container, Health UI status, and successful or failed health JSON.
What it assumes
Assumes a Quarkus application with a configured JDBC data source and introduces the SmallRye Health extension.
What you can do after
Diagnose database availability via Quarkus Health UI and HTTP health endpoints.
How it connects
Connects JDBC data sources with readiness probes, SmallRye Health, health endpoints, and Dev Services.

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.