Skip to content

fix mysql driver class - #7478

Merged
tfmorris merged 2 commits into
OpenRefine:masterfrom
smierz:gh-5794-fix-mysql-driver-namespace
Oct 21, 2025
Merged

tfmorris merged 2 commits into
OpenRefine:masterfrom
smierz:gh-5794-fix-mysql-driver-namespace

Conversation

@smierz

@smierz smierz commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

fixes #5794

Changes proposed in this pull request:

Source

The name of the class that implements java.sql.Driver in MySQL Connector/J has changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. The old class name has been deprecated.

Source: https://dev.mysql.com/doc/connectors/en/connector-j-upgrading-to-8.0.html

@github-actions github-actions Bot added the Type: Bug Issues related to software defects or unexpected behavior, which require resolution. label Oct 2, 2025
@tfmorris
tfmorris requested a review from Copilot October 4, 2025 00:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the MySQL JDBC driver class name from the deprecated com.mysql.jdbc.Driver to the current com.mysql.cj.jdbc.Driver to resolve a deprecation warning and ensure compatibility with MySQL Connector/J 8.0+.

Key Changes:

  • Updated MySQL driver class constant to use the modern JDBC driver
  • Added a test to verify the driver class can be loaded

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
MySQLDatabaseService.java Updated DB_DRIVER constant to use the current MySQL JDBC driver class
MySQLConnectionManagerTest.java Added test to verify driver class loading works correctly

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

private static final Logger logger = LoggerFactory.getLogger("MySQLDatabaseService");
public static final String DB_NAME = "mysql";
public static final String DB_DRIVER = "com.mysql.jdbc.Driver";
public static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
public static final String DB_DRIVER = com.mysql.cj.jdbc.Driver.class.getCanonicalName();

I dislike hiding class names in strings unless there's no choice. Is there any reason for us to not just use the class reference so that our tooling can help us track dependencies?

(I understand that this problem was not introduced by your PR)

@tfmorris
tfmorris force-pushed the gh-5794-fix-mysql-driver-namespace branch from fdc4d37 to 4a490e3 Compare October 21, 2025 19:34

@tfmorris tfmorris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and updated the PR based on my suggestion and dropped the test.

I've created #7504 to address the driver class references in the rest of the database drivers.

@tfmorris
tfmorris merged commit 40351e5 into OpenRefine:master Oct 21, 2025
17 checks passed
@smierz
smierz deleted the gh-5794-fix-mysql-driver-namespace branch October 22, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Issues related to software defects or unexpected behavior, which require resolution.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL driver class is deprecated

3 participants