Friday, October 16, 2009

Specify initial size for Commons DBCP BasicDatasource

It is fairly easy to setup database pooling with Spring and Commons DBCP BasicDatasource. However, the pool's default initial size is 0 if you look it up in the source code. To change that, specify "initialSize" in your configuration.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="initialSize">
<value>10</value>
</property>
</bean>

No comments:

Post a Comment