From 2dc6a886fe7cec075df14086742cb5bf41ff4bea Mon Sep 17 00:00:00 2001 From: "simon.song" Date: Mon, 22 Mar 2021 11:23:53 +0800 Subject: [PATCH] =?UTF-8?q?14492=2019048-=E4=BA=A7=E5=93=81=E8=BF=BD?= =?UTF-8?q?=E6=BA=AF=E6=8A=A5=E8=A1=A8OP10-OP70=E5=B7=A5=E4=BD=8D=EF=BC=8C?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8D=E5=AF=B9-20210316=EF=BC=88=E6=97=B6?= =?UTF-8?q?=E5=8C=BA=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/CommonEnumUtil.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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; }