You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
628 B
24 lines
628 B
package config;
|
|
|
|
import java.sql.Driver;
|
|
|
|
public enum DBType {
|
|
mysql57(com.mysql.cj.jdbc.Driver.class);
|
|
|
|
private Class<? extends Driver> driver;
|
|
|
|
DBType(Class<? extends Driver> driver) {
|
|
this.driver = driver;
|
|
}
|
|
|
|
public Class<? extends Driver> getDriver() {
|
|
return driver;
|
|
}
|
|
|
|
public String getUrl(String host,int port,String name){
|
|
switch (DBType.valueOf(this.name())){
|
|
case mysql57: return "jdbc:mysql://" + host + ":" + port + "/" + name + "?serverTimezone=GMT%2b8";
|
|
default:throw new RuntimeException("NotFound type:"+this.name());
|
|
}
|
|
}
|
|
}
|
|
|