首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

记录上数据连接池的一些设置

2012-10-09 
记录下数据连接池的一些设置* 配置文件 */private final String c3p0Properties jdbc.properties/**

记录下数据连接池的一些设置

* 配置文件 */private final String c3p0Properties = "jdbc.properties";/** * 初始化数据源 * @throws IOException 读取配置文件 * @throws PropertyVetoException * @see {@link java.beans.PropertyVetoException}} */private DBConnection() throws IOException, PropertyVetoException {Properties p = new Properties();p.load(this.getClass().getResourceAsStream(c3p0Properties));ds = new ComboPooledDataSource();ds.setDriverClass(p.getProperty("jdbc.driverClassName"));ds.setJdbcUrl(p.getProperty("jdbc.url"));ds.setUser(p.getProperty("jdbc.username"));ds.setPassword(p.getProperty("jdbc.password"));ds.setMaxPoolSize(Integer.parseInt(p.getProperty("jdbc.pool.maxsize")));ds.setMaxIdleTime(60);}

热点排行