修复postgresql同步报错问题

This commit is contained in:
inrgihc
2023-04-11 23:07:49 +08:00
parent 18619052b3
commit 4e6e2f3fab
2 changed files with 5 additions and 3 deletions

View File

@@ -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();

View File

@@ -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