Skip to content

mysql-connector-j library is required for proper exception handling for mariadb mode #1285

@johnB96

Description

@johnB96

Describe the bug

Say I have a connection string in the following manner: jdbc:aws-wrapper:mariadb://db-host/db_name

To me, this implies that I only need the mariadb-java-client library.

However, given the MariaDBExceptionHandler extends MySQLExceptionHandler creates an implied dependency on mysql-connector-j. Because MySQLExceptionHandler has a reference to com.mysql.cj.exceptions.CJException

However, we deliberately want to avoid using the mysql-connector-j driver due to the GPL license and instead want to only mariadb-java-client. Therefore, MariaDBExceptionHandler should be written in a manner to not require mysql-connector-j.

Expected Behavior

I expected proper exception handling.

What plugins are used? What other connection properties were set?

wrapperPlugins=iam

Current Behavior

Today, I get a class not defined exception

Caused by: java.lang.NoClassDefFoundError: com/mysql/cj/exceptions/CJException
	at software.amazon.jdbc.exceptions.MySQLExceptionHandler.isLoginException(MySQLExceptionHandler.java:78)
	at software.amazon.jdbc.exceptions.ExceptionManager.isLoginException(ExceptionManager.java:35)

Reproduction Steps

get a connection error while running the mariadb driver

Possible Solution

Rewrite the MariaDBExceptionHandler to not reference com.mysql.cj.exceptions.CJException

Additional Information/Context

No response

The AWS Advanced JDBC Driver version used

2.5.4

JDK version used

openjdk 23.0.2 2025-01-21 OpenJDK Runtime Environment Zulu23.32+11-CA (build 23.0.2+7) OpenJDK 64-Bit Server VM Zulu23.32+11-CA (build 23.0.2+7, mixed mode, sharing)

Operating System and version

ProductName: macOS ProductVersion: 15.3.1 BuildVersion: 24D70

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending releaseResolution implemented, pending official release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions