Skip to content

Update deprecated MySQL driver class to align with Connector/J 9.5 standards #628

Description

@adangel

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify the MySQL driver class compatibility.

The driver class com.mysql.jdbc.Driver is deprecated and was replaced by com.mysql.cj.jdbc.Driver in MySQL Connector/J 8.0+. Since this test uses mysql-connector-j version 9.5.0 (line 34), the old driver class may not be available, potentially causing the integration test to fail with a ClassNotFoundException.

Apply this diff to use the current driver class:

-                    <driver>com.mysql.jdbc.Driver</driver>
+                    <driver>com.mysql.cj.jdbc.Driver</driver>

To verify driver class availability in mysql-connector-j 9.5.0, run:

Alternatively, verify with documentation:


🏁 Script executed:

#!/bin/bash
# Check if the old driver class exists in mysql-connector-j JAR
# Download the JAR and list its contents to verify driver class presence

echo "Checking mysql-connector-j 9.5.0 for driver classes..."
curl -s "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/9.5.0/mysql-connector-j-9.5.0.jar" -o /tmp/mysql-connector.jar
unzip -l /tmp/mysql-connector.jar | grep -E "Driver\.class" | head -20

Length of output: 248


🌐 Web query:

MySQL Connector/J 9.5 driver class name

💡 Result:

The driver class name is com.mysql.cj.jdbc.Driver. [1][2]

Sources:
[1] MySQL Connector/J Reference — Driver/Datasource Class Name.
[2] MySQL Connector/J Developer Guide — Connecting via DriverManager.


Update deprecated MySQL driver class to align with Connector/J 9.5 standards.

The old driver class com.mysql.jdbc.Driver is still available in mysql-connector-j 9.5.0, so this won't cause ClassNotFoundException. However, the official driver class name for mysql-connector-j is com.mysql.cj.jdbc.Driver, and using the deprecated class is not recommended. Update to follow current best practices:

-                    <driver>com.mysql.jdbc.Driver</driver>
+                    <driver>com.mysql.cj.jdbc.Driver</driver>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

                    <driver>com.mysql.cj.jdbc.Driver</driver>
🤖 Prompt for AI Agents
In src/it/addColumnAsPrimaryKey/pom.xml around line 39, the configured MySQL
JDBC driver class is the deprecated com.mysql.jdbc.Driver; update the driver
element to use the current official class name com.mysql.cj.jdbc.Driver. Replace
the driver value with com.mysql.cj.jdbc.Driver so the project follows
Connector/J 9.5+ conventions and avoids relying on the deprecated class alias.

Originally posted by @coderabbitai[bot] in #621 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions