|
@@ -1,5 +1,6 @@
|
|
|
package org.dbsyncer.connector.util;
|
|
|
|
|
|
+import org.dbsyncer.common.util.StringUtil;
|
|
|
import org.dbsyncer.connector.ConnectorException;
|
|
|
|
|
|
import java.sql.Connection;
|
|
@@ -12,10 +13,12 @@ public abstract class DatabaseUtil {
|
|
|
}
|
|
|
|
|
|
public static Connection getConnection(String driverClassName, String url, String username, String password) throws SQLException {
|
|
|
- try {
|
|
|
- Class.forName(driverClassName);
|
|
|
- } catch (ClassNotFoundException e) {
|
|
|
- throw new ConnectorException(e.getCause());
|
|
|
+ if (StringUtil.isNotBlank(driverClassName)) {
|
|
|
+ try {
|
|
|
+ Class.forName(driverClassName);
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
+ throw new ConnectorException(e.getCause());
|
|
|
+ }
|
|
|
}
|
|
|
return DriverManager.getConnection(url, username, password);
|
|
|
}
|