172 * 173 * @param props 属性 174 */ 175 private void loadDrivers(Properties props) { 176 String driverClasses = props.getProperty("drivers"); 177 StringTokenizer st = new StringTokenizer(driverClasses); 178 while (st.hasMoreElements()) { 179 String driverClassName = st.nextToken().trim(); 180 try { 181 Driver driver = (Driver) 182 Class.forName(driverClassName).newInstance(); 183 DriverManager.registerDr iver(driver); 184 drivers.addElement(driver); 185 log("成功注册JDBC驱动程序\\\" + driverClassName); 186 } 187 catch (Exception e) { 188 log("无法注册JDBC驱动程序: " + 189 driverClassName + ", 错误: " + e); 190 } 191 } 192 } 193 194 /** 195 * 将文本信息写入日志文件 196 */ 197 private void log(String msg) { 198 log.println(new Date() + ": " + msg); 199 } 200 201 /** 202 * 将文本信息与异常写入日志文件 203 */ 204 private void log(Throwable e, String msg) { 205 log.println(new Date() + ": " + msg); 206 e.printStackTrace(log); 207 } 208 209 /** 210 * 此内部类定义了一个连接池.它能够根据要求创建新连接,直到预定的最\\r
|