update exception

This commit is contained in:
jipengfei-jpf
2023-07-18 21:34:49 +08:00
parent c81985e916
commit 94e83b3e89

View File

@ -84,24 +84,16 @@ public class IDriverManager {
driverEntry = getJDBCDriver(driver); driverEntry = getJDBCDriver(driver);
} }
try { try {
Connection con = driverEntry.getDriver().connect(url, info); return driverEntry.getDriver().connect(url, info);
if (con != null) {
return con;
}
} catch (SQLException var7) { } catch (SQLException var7) {
Connection con = tryConnectionAgain(driverEntry, url, info); Connection con = tryConnectionAgain(driverEntry, url, info);
if (con != null) { if (con != null) {
return con; return con;
} else { } else {
throw var7; throw new SQLException("Cannot create connection (" + var7.getMessage() + ")", "08001",
var7);
} }
} }
if (reason != null) {
throw reason;
} else {
throw new SQLException("No suitable driver found for " + url, "08001");
}
} }
private static Connection tryConnectionAgain(DriverEntry driverEntry, String url, private static Connection tryConnectionAgain(DriverEntry driverEntry, String url,