this.setUserName(userName); this.setPassword(password); init(); } private void init() { super.setDriverName(dbDriver); super.setUrl("jdbc:microsoft:sqlserver://" + host.trim() + ":" + new Integer(port).toString() + ";DatabaseName=" + databaseName.trim()); //super.setUrl("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=demo"); } public void setHost(String host) { //处理主机名称 if ( (host == null) || (host.equals("")) || (host.equals(".")) || (host.equals("local"))) { host = "localhost"; } int index = host.indexOf("//", 0); if (index == 0) { host = host.substring(2); //去掉前面的"//" } index = host.indexOf("//", 0); if (index >= 0) { try { throw new Exception("SQL Server主机名参数错误!"); } catch (Exception ex) {
|