示例#1
0
 public static void addConnPool(ZCDatabaseSchema db) {
   DBConnConfig dcc = new DBConnConfig();
   dcc.DBName = db.getDBName();
   dcc.DBPassword = db.getPassword();
   dcc.DBPort = (int) db.getPort();
   dcc.DBServerAddress = db.getAddress();
   dcc.DBType = db.getServerType();
   dcc.DBUserName = db.getUserName();
   dcc.PoolName = ("_OuterDatabase_" + db.getID());
   dcc.TestTable = db.getTestTable();
   dcc.isLatin1Charset = "Y".equals(db.getLatin1Flag());
   if (!DBConnPool.getPoolMap().containsKey(dcc.PoolName + ".")) new DBConnPoolImpl(dcc);
 }
示例#2
0
 public void save() {
   ZCDatabaseSchema db = new ZCDatabaseSchema();
   if (StringUtil.isEmpty($V("ID"))) {
     db.setValue(this.Request);
     db.setID(NoUtil.getMaxID("DatabaseID"));
     db.setAddTime(new Date());
     db.setAddUser(User.getUserName());
     db.setSiteID(Application.getCurrentSiteID());
     if (db.insert()) this.Response.setMessage("添加数据库连接成功");
     else this.Response.setError("发生错误,添加数据库连接失败");
   } else {
     db.setID(Long.parseLong($V("ID")));
     db.fill();
     db.setValue(this.Request);
     db.setModifyTime(new Date());
     db.setModifyUser(User.getUserName());
     if (db.update()) this.Response.setMessage("修改数据库连接成功");
     else {
       this.Response.setError("发生错误,修改数据库连接失败");
     }
   }
   removeConnPool(db.getID());
   addConnPool(db);
 }