return DriverManager.getConnection(url, properties);
} catch (Exception e) {
// if the current class loader can not access the driver class, create driver class directly
try {
Driver driverObject = driverClass.getConstructor().newInstance();
Connection connection = driverObject.connect(url, properties);
if (connection == null) {
throw new IllegalStateException(MessageFormat.format(
"Driver class {0} may not support {1}",
driverClass.getName(),
url));