jinkachy commented on code in PR #8986:
URL: https://github.com/apache/seatunnel/pull/8986#discussion_r2000845404
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:
##########
@@ -116,6 +122,33 @@ protected Connection getConnection(String url) {
if (connectionMap.containsKey(url)) {
return connectionMap.get(url);
}
+ if (driverClass != null) {
+ log.info("try to find driver {}", driverClass);
+ java.util.Properties info = new java.util.Properties();
+ if (username != null) {
+ info.put("user", username);
+ }
+ if (pwd != null) {
+ info.put("password", pwd);
+ }
+ Enumeration<Driver> drivers = DriverManager.getDrivers();
+ try {
+ // Driver Manager may load the wrong driver, prioritize
finding the driver by class
+ // name
+ while (drivers.hasMoreElements()) {
+ Driver driver = drivers.nextElement();
+ if (StringUtils.equals(driver.getClass().getName(),
driverClass)) {
+ try {
+ return driver.connect(url, info);
Review Comment:
> the connection should be put into connection map to reused. Please refer
https://github.com/apache/seatunnel/pull/8986/files#diff-fea654341466928ce751051d2a2b1718e1d267834b9468ddc02c15ba87922ac6R154
@Hisoka-X thanks, you are right. done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]