mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-09-25 16:13:24 +08:00
Support for custom drivers
This commit is contained in:
@ -46,7 +46,7 @@ public class Chat2DBContext {
|
||||
}
|
||||
}
|
||||
|
||||
public static DriverConfig getDefaultDriverConfig(String dbType){
|
||||
public static DriverConfig getDefaultDriverConfig(String dbType) {
|
||||
return PLUGIN_MAP.get(dbType).getDBConfig().getDefaultDriverConfig();
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class Chat2DBContext {
|
||||
return PLUGIN_MAP.get(getConnectInfo().getDbType()).getMetaData();
|
||||
}
|
||||
|
||||
public static DBConfig getDBConfig(){
|
||||
public static DBConfig getDBConfig() {
|
||||
return PLUGIN_MAP.get(getConnectInfo().getDbType()).getDBConfig();
|
||||
}
|
||||
|
||||
@ -103,6 +103,12 @@ public class Chat2DBContext {
|
||||
if (session != null) {
|
||||
url = url.replace(host, "127.0.0.1").replace(port, ssh.getLocalPort());
|
||||
}
|
||||
DriverConfig config = connectInfo.getDriverConfig();
|
||||
if (config == null) {
|
||||
config = getDefaultDriverConfig(connectInfo.getDbType());
|
||||
connectInfo.setDriverConfig(config);
|
||||
}
|
||||
|
||||
connection = getConnect(url, host, port, connectInfo.getUser(),
|
||||
connectInfo.getPassword(), connectInfo.getDbType(),
|
||||
connectInfo.getDriverConfig(), ssh, connectInfo.getExtendMap());
|
||||
|
Reference in New Issue
Block a user