Skip to content

Commit

Permalink
[#6392] fix(test): SparkJdbcMysqlCatalogIT33 failed in some enviroment (
Browse files Browse the repository at this point in the history
#6568)

### What changes were proposed in this pull request?

I'm not sure the root reason, seems MYSQL JDBC driver was not loaded
automatically in some condition, in this PR, load Mysql driver
explicitly.

### Why are the changes needed?

Fix: #6392 

### Does this PR introduce _any_ user-facing change?
no

### How was this patch tested?
test in local machine.

Co-authored-by: FANNG <[email protected]>
Co-authored-by: Qi Yu <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2025
1 parent 681845f commit 722cdab
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ public void createDatabase(TestDatabaseName testDatabaseName) {
StringUtils.substring(
getJdbcUrl(testDatabaseName), 0, getJdbcUrl(testDatabaseName).lastIndexOf("/"));

// Fix https://github.com/apache/gravitino/issues/6392, MYSQL JDBC driver may not load
// automatically.
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (Exception e) {
throw new RuntimeException("Failed to load MySQL JDBC driver", e);
}

// change password for root user, Gravitino API must set password in catalog properties
try (Connection connection =
DriverManager.getConnection(mySQLJdbcUrl, USER_NAME, getPassword());
Expand Down

0 comments on commit 722cdab

Please sign in to comment.