|
|
|
@ -4,10 +4,10 @@ import org.hibernate.dialect.*; |
|
|
|
|
|
|
|
|
|
import java.sql.Driver; |
|
|
|
|
|
|
|
|
|
public enum DBType{ |
|
|
|
|
mysql5(com.mysql.jdbc.Driver.class, MySQL5Dialect.class), |
|
|
|
|
mysql55(com.mysql.jdbc.Driver.class, MySQL55Dialect.class), |
|
|
|
|
mysql57(com.mysql.jdbc.Driver.class, MySQL57Dialect.class), |
|
|
|
|
public enum DBType { |
|
|
|
|
mysql5(com.mysql.cj.jdbc.Driver.class, MySQL5Dialect.class), |
|
|
|
|
mysql55(com.mysql.cj.jdbc.Driver.class, MySQL55Dialect.class), |
|
|
|
|
mysql57(com.mysql.cj.jdbc.Driver.class, MySQL57Dialect.class), |
|
|
|
|
mysql8(com.mysql.cj.jdbc.Driver.class, MySQL8Dialect.class); |
|
|
|
|
|
|
|
|
|
private Class<? extends Driver> driver; |
|
|
|
@ -26,14 +26,15 @@ public enum DBType{ |
|
|
|
|
return dialect; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getUrl(String host,int port,String name){ |
|
|
|
|
switch (DBType.valueOf(this.name())){ |
|
|
|
|
public String getUrl(String host, int port, String name) { |
|
|
|
|
switch (DBType.valueOf(this.name())) { |
|
|
|
|
case mysql5: |
|
|
|
|
case mysql55: |
|
|
|
|
case mysql57: |
|
|
|
|
case mysql8: |
|
|
|
|
return "jdbc:mysql://" + host + ":" + port + "/" + name + "?serverTimezone=GMT%2b8"; |
|
|
|
|
default:throw new RuntimeException("NotFound type:"+this.name()); |
|
|
|
|
default: |
|
|
|
|
throw new RuntimeException("NotFound type:" + this.name()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|