Support MariaDB JDBC url and MariaDB driver

Hi Everyone :man_raising_hand:

As part of improving standalone efforts (GSOC 2025) within the OpenMRS, I would like to propose that we officially support the MariaDB JDBC URL and Driver in addition to the existing MySQL setup.

:pushpin: Problem:

Currently, OpenMRS primarily configures JDBC connections using MySQL conventions

jdbc:mysql://localhost:3306/openmrs

However, when using MariaDB, using the MySQL JDBC URL has lead to compatibility issues with recent versions of the MariaDB server (11.4.5). For instance, am encounter errors such as:

java.sql.SQLSyntaxErrorException: Unknown column ‘RESERVED’ in ‘WHERE’

which call for a solution discussed here

This arises because MySQL and MariaDB have diverged slightly in metadata handling, and the MySQL Connector/J driver does not guarantee compatibility with newer MariaDB versions.

:white_check_mark: Proposed Solution:

  1. Allow specifying MariaDB-compliant JDBC URLs in runtime properties and configuration wizards

jdbc:mariadb://localhost:3306/openmrs

  1. Include the official MariaDB JDBC Driver (com.mysql.cj.jdbc.Driver) as a supported dependency during setup (openmrs core).
  2. Detect database type (MariaDB vs MySQL) early in setup to avoid known issues with reserved word lookups and changelog parsing in Liquibase.

For the existing drivers supported u can check out here

I’d love to hear your feedback or if others have run into this issue.

cc @ibacher @wikumc @dkayiwa @burke @mseaton @grace

1 Like
  • MariaDB 11.4.5 of recent introduced changes that are incompatible with MySQL 8 drivers. So i think for some reasons, It makes sense to include it.
1 Like

Definitely worth supporting, but we should also be keen just incase of Liquibase compatibility issues, driver dependencies, and ensuring backward compatibility with MySQL users. Happy to help verify this across test setups.

1 Like

What are your thoughts on having MariaDB4J support a lower version of MariaDB? At least the one we support in O3?

Oh yes, that would have been a great idea. However, earlier versions had compatibility issues with M1 and M2 Mac silicon chips. That’s why they opted for a newer version (11.4.5).

Note: Older versions of MariaDB4j lacked support for Apple Silicon (M1, M2+), which remains a critical issue on those machines.

On trying the lower version of MariaDB4j (3.1.0) using MariaDB binaries 10.11.5 on a linux machine 20.0.4 using mysql jdbc url and driver

Am getting liquibase errors INFO - Slf4JLogger.log(43) |2025-05-28T18:19:14,864| Marking ChangeSet: "liquiba - Pastebin.com still connected to mariadb

cc @dkayiwa @wikumc