diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java index aeaa624..f41a6f6 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java @@ -1978,6 +1978,21 @@ public class CommonEnumUtil { return null; } + public String getJDBCUrlToMysql(String database, String host, Integer port) { + if (this.getValue() == SOURCE_MARIA_DB.getValue()) { + return getJDBCUrlMySQLBy8x(database, host, port); + } else if (this.getValue() == SOURCE_ORACLE.getValue()) { + return getJDBCUrlOracle(database, host, port); + } else if (this.getValue() == SOURCE_POSTGRE_SQL.getValue()) { + return getJDBCUrlPostgreSQL(database, host, port); + } else if (this.getValue() == SOURCE_SQL_SERVER.getValue()) { + return getJDBCUrlSQLServer(database, host, port); + } else if (this.getValue() == SOURCE_SAP_HANA.getValue()) { + return getJDBCUrlSapHana(database, host, port); + } + return null; + } + public String getJDBCUrl(String database, String host, Integer port, String instanceName) { if (this.getValue() == SOURCE_MARIA_DB.getValue()) { return getJDBCUrlMySQL(database, host, port); @@ -2020,6 +2035,16 @@ public class CommonEnumUtil { "&serverTimezone=CST"; } + //MySQL8.x时区设置 + private String getJDBCUrlMySQLBy8x(String database, String host, Integer port) { + return "jdbc:mysql://" + host + ":" + port + "/" + database + + "?autoReconnect=true" + + "&useSSL=false" + + "&characterEncoding=utf-8" + + "&allowPublicKeyRetrieval=true" + + "&serverTimezone=Asia/Shanghai"; + } + private String getJDBCUrlOracle(String database, String host, Integer port) { return "jdbc:oracle:thin:@" + host + ":" + port + ":" + database; }