Commit 469044e0 authored by 黎博's avatar 黎博

修改DBUtils里的数据库初始化语句获取方式

parent c7c804e1
package cn.qg.qaplatform.utils; package cn.qg.qaplatform.utils;
import cn.qg.qaplatform.config.NamespaceCache;
import cn.qg.qaplatform.enums.Namespace; import cn.qg.qaplatform.enums.Namespace;
import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.QueryRunner;
...@@ -23,10 +24,12 @@ public class DBUtils { ...@@ -23,10 +24,12 @@ public class DBUtils {
private Connection conn = null; private Connection conn = null;
private Statement stmt = null; private Statement stmt = null;
public DBUtils(String namespace, String database, String username, String password) { public DBUtils(String namespace, String database, String username, String password) {
Map<String, String> nsMap = NamespaceCache.namespaceMap;
this.username = username; this.username = username;
this.password = password; this.password = password;
this.db_url = Namespace.valueOf(namespace.toUpperCase()).getUrl() + database; this.db_url = "jdbc:mysql://" + nsMap.get(namespace) + "/" + database;;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment