Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,21 @@ private static synchronized Connection connect(DataBaseType dataBaseType,
String url, Properties prop) {
try {
Class.forName(dataBaseType.getDriverClassName());
try {
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
if (StringUtils.equals(driver.getClass().getName(), dataBaseType.getDriverClassName())) {
try {
return driver.connect(url, prop);
} catch (Exception e) {
LOG.info("try connector failed", e);
}
}
}
} catch (Exception e) {
LOG.info("find driver error, back to DriverManager.getConnection", e);
}
DriverManager.setLoginTimeout(Constant.TIMEOUT_SECONDS);
return DriverManager.getConnection(url, prop);
} catch (Exception e) {
Expand Down