Skip to content

MariaDB JDBC detection logic is incorrect with apps using MySQL Connector/j >= 8.0.31 #1027

@abg

Description

@abg

My team maintains a MySQL broker for TAS. In our test pipelines, we deploy a couple different Spring based apps to test JDBC bindings. One of these apps is built exclusively with the Oracle MySQL Connector/j. In a recent dependency bump, we noticed that the app was using the MariaDB v2.7.9 connector rather than MySQL connector bundled in the app. This seems to occur after we bumped to MySQL Connector/j v8.0.31+.

We discovered that Oracle recently renamed the Maven coordinates from mysql-connector-java to mysql-connector-j, this in turn changed the file naming convention from mysql-connector-java-$VERSION.jar to mysql-connector-j-$VERSION.jar. This applies to MySQL Connector/j 8.0.31+, even when using the legacy mysql:mysql-connector-java reference. We think this naming change may have broken some assumptions in java-buildpacks MariaDB JDBC Framework

Reproduction steps:

  • Clone spring-music

  • Build the app ./gradlew assemble

    Observe that the app is built with mysql-connector-j-8.0.33 (e.g. by inspecting unzip -l build/libs/spring-music-1.0.jar | grep -E 'maria|mysql' or similar)

  • Push the app

  • Bind the app to a MySQL service

  • Start the app

    Observe that java-buildpack downloads the MariaDB JDBC connector, even though a MySQL connector is present.

Under the hood, on the MySQL database we can also see that the app is incorrectly using the MariaDB connector provided by the buildpack:

mysql> SELECT ATTR_NAME, ATTR_VALUE FROM performance_schema.session_connect_attrs;
+------------------+----------------------+
| ATTR_NAME        | ATTR_VALUE           |
+------------------+----------------------+
| _runtime_version | 17.0.8.              |
| _client_version  | 2.7.9                |
| _client_license  | GPL                  |
| _runtime_vendor  | BellSoft             |
| _client_name     | MariaDB Connector/J  |
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions