MySQL JDBC Driver Errors in Dockerized Ignition Setup

I encountered an issue while setting up my Docker Compose environment (Ignition, MySQL, and SMTP server) for training.

I'm automating the upload of the MySQL JDBC driver by mounting the file directly to the expected JDBC path in my Ignition container. However, placing the .jar file directly at the designated location caused the other drivers to appear faulted. Even though MySQL was listed as installed, I couldn't establish a successful connection to my database.

As a test, I set up the same Docker stack without the volume mount, which allowed me to observe the default state of installed or faulted drivers. I then manually uploaded the .jar file from my host machine and attempted a connection, which succeeded.

Currently, my workaround is to upload the file during container creation, ensuring the gateway has the necessary driver for MySQL.

Any insights on why directly mounting the file causes issues with other drivers and connection establishment?

- ./jdbc:/usr/local/bin/ignition/user-lib/jdbc/

a85f3e79-282c-487f-98b1-f70ff0559d57
Impact of Direct JDBC Mounting: Faulted Drivers in Ignition Gateway


Impact of Direct JDBC Mounting: Failed DB Connection

Default State of JDBC Drivers in Ignition Gateway Without Mounting

Manually Uploading of .jar File

MySQL Driver Installed Status

Successful DB Connection

Consider preloading a gateway backup--that contains the JDBC drivers and metadata for them from the source system.

1 Like

Appreciate the feedback. I'll be sure to use this approach going forward. Just wanted to double-check that I wasn't overlooking a step in my original attempt using a volume mount.

You should be able to bind-mount that specific driver all the way into place, e.g.:

- ./jdbc/mysql-connector-j-8.3.0.jar:/usr/local/bin/ignition/user-lib/jdbc/mysql-connector-j.jar

By bind-mounting the entire folder, you effectively shadow the pre-existing files that are part of the image (such as the MariaDB, Postgres, and MSSQL JDBC drivers, as well as the commons-dbcp2 and commons-pool2 JARs).

5 Likes

I have just verified this suggestion and it worked. Thank you!

Tangent to the main question posed, worth noting that you probably also don't need the MySQL driver at all. The MariaDB driver (as far as I know) is able to connect to MySQL no problem.

1 Like

I have found that the Maria driver performs better as well. We switched a customer from the MySQL to Maria driver and got more than 10% CPU back (we are really really heavy DB users).

Some performance comparisons that may or may not be biased.

And you have the advantage of not having to deal with extra licensing terms.

4 Likes

Thanks for sharing!