数据库配置不再强制要求单独存放数据库名称

This commit is contained in:
wind 2023-04-23 21:49:33 +08:00
parent a7fdb952bc
commit fbdb456dca

View File

@ -46,8 +46,13 @@ public class JDBCTool {
*/
public Connection getConn() {
Connection connection;
String url;
try {
String url = config.getUrl() + "/" + config.getDatabaseName();
if (config.getDatabaseName().isEmpty()){
url = config.getUrl();
}else{
url = config.getUrl() + "/" + config.getDatabaseName();
}
connection = DriverManager.getConnection(url, config.getUsername(), config.getPassword());
} catch (SQLException e) {
throw new SmsSqlException(e.getMessage());