mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for load driverClass
This commit is contained in:
@@ -488,12 +488,23 @@ public final class JdbcUtils {
|
||||
}
|
||||
|
||||
public static Driver createDriver(String driverClassName) throws SQLException {
|
||||
ClassNotFoundException exception = null;
|
||||
try {
|
||||
return (Driver) Class.forName(driverClassName).newInstance();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
exception = e;
|
||||
}
|
||||
|
||||
try {
|
||||
return (Driver) Thread.currentThread().getContextClassLoader().loadClass(driverClassName).newInstance();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new SQLException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user