データ接続プールの設定を記録
910 ワード
*
*/
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);
}