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
… (backport #51765) (#51774)

Co-authored-by: Smith Cruise <[email protected]>
  • Loading branch information
mergify[bot] and Smith-Cruise authored Oct 11, 2024
1 parent df776b6 commit 2f40172
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,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 @@ -107,6 +107,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 2f40172

Please sign in to comment.