Skip to content

Commit

Permalink
[BugFix] Fix jdbc catalog change password not effect (backport #51748) (
Browse files Browse the repository at this point in the history
#51765)

Signed-off-by: Smith Cruise <[email protected]>
  • Loading branch information
Smith-Cruise authored Oct 11, 2024
1 parent cc50e0d commit 67cfd77
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public JDBCScanner(String driverLocation, JDBCScanContext scanContext) {
}

public void open() throws Exception {
String key = scanContext.getUser() + "/" + scanContext.getJdbcURL();
String cacheKey = computeCacheKey(scanContext.getUser(), scanContext.getPassword(), scanContext.getJdbcURL());
URL driverURL = new File(driverLocation).toURI().toURL();
DataSourceCache.DataSourceCacheItem cacheItem = DataSourceCache.getInstance().getSource(key, () -> {
DataSourceCache.DataSourceCacheItem cacheItem = DataSourceCache.getInstance().getSource(cacheKey, () -> {
ClassLoader classLoader = URLClassLoader.newInstance(new URL[] {
driverURL,
});
Expand Down Expand Up @@ -118,6 +118,10 @@ public void open() throws Exception {
}
}

private static String computeCacheKey(String username, String password, String jdbcUrl) {
return username + "/" + password + "/" + jdbcUrl;
}

private static final Set<Class<?>> GENERAL_JDBC_CLASS_SET = new HashSet<>(Arrays.asList(
Boolean.class,
Short.class,
Expand Down

0 comments on commit 67cfd77

Please sign in to comment.