diff --git a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java index b22e7068..e2e7e9a2 100644 --- a/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java +++ b/dbswitch-data/src/main/java/com/gitee/dbswitch/data/util/DataSourceUtils.java @@ -179,7 +179,9 @@ public final class DataSourceUtils { throw new RuntimeException(e); } }).toArray(URL[]::new); - URLClassLoader loader = new URLClassLoader(urls, null); + ClassLoader parent = driverClass.contains("postgresql") + ? Thread.currentThread().getContextClassLoader() : null; + URLClassLoader loader = new URLClassLoader(urls, parent); try { Class clazz = loader.loadClass(driverClass); clazz.newInstance(); diff --git a/dbswitch-data/src/main/resources/config.yml b/dbswitch-data/src/main/resources/config.yml index 6aa6d632..3acb85ae 100644 --- a/dbswitch-data/src/main/resources/config.yml +++ b/dbswitch-data/src/main/resources/config.yml @@ -5,7 +5,7 @@ dbswitch: ## support multiple source database connection - url: jdbc:mysql://172.17.2.10:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&tinyInt1isBit=false&rewriteBatchedStatements=true&useCompression=true driver-class-name: 'com.mysql.jdbc.Driver' - driver-path: D:/Workspace/dbswitch/drivers/mysql/mysql-5.7 + driver-path: D:/Workspace/dbswitch/drivers/mysql/mysql-5 username: 'test' password: '123456' # source database configuration parameters @@ -31,7 +31,7 @@ dbswitch: ## Best support for Oracle/PostgreSQL/Greenplum/DM etc. url: jdbc:postgresql://172.17.2.10:5432/test driver-class-name: org.postgresql.Driver - driver-path: D:/Workspace/dbswitch/driver/postgresql/postgresql-11.4 + driver-path: D:/Workspace/dbswitch/drivers/postgresql/postgresql-11.4 username: 'test' password: '123456' # target database configuration parameters