In our application we are managing datasource through C3P0PooledDataSource and configuration is done in applicationContext.xml file.
<bean id="parentDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" abstract="true">
<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />
<property name="minPoolSize" value="${jdbc.minPoolSize}" />
<property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
<property name="maxIdleTime" value="${jdbc.maxIdleTime}" />
<property name="maxIdleTimeExcessConnections" value="${jdbc.maxIdleTimeExcessConnections}" />
</bean>
<bean id="ds1" parent="parentDataSource" singleton="true">
<property name="driverClass" value="${ds1.jdbc.driver}" />
<property name="jdbcUrl" value="${ds1.jdbc.url}"/>
<property name="user" value="${ds1.jdbc.user}" />
<property name="password" value="${ds1.jdbc.password}" />
</bean>
<bean id="ds2" parent="parentDataSource" singleton="true">
<property name="driverClass" value="${ds2.jdbc.driver}" />
<property name="jdbcUrl" value="${ds2.jdbc.url}"/>
<property name="user" value="${ds2.jdbc.user}" />
<property name="password" value="${ds2.jdbc.password}" />
</bean>
Now at the time of deployment there are 2 pools created and each of them has its own minPoolSize and accordingly those many connections are being created. Is there any way that we can defined the configuration of minPoolSize, maxPoolSize etc at one level and all data sources will be managed through that.