Santosh Hegde
Santosh Hegde

Reputation: 3520

How to open all connections as soon as application deployed?

<beans:bean id="scimDataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <beans:property name="driverClassName" value="${oracle.driver}" />
        <beans:property name="url" value="${oracle.url}" />
        <beans:property name="username" value="${oracle.user}" />
        <beans:property name="password" value="${oracle.password}" />
        <beans:property name="initialSize" value="2" />
        <beans:property name="maxActive" value="15" />
        <beans:property name="maxIdle" value="3" />
    </beans:bean>

This is the configuration im using to create pool. I want the 2 connection to be open as soon as the application starts. But now its opening the first connection after i make the first request.Then its available in the pool.

How can i open all the connection in the beginning itself?

Upvotes: 0

Views: 195

Answers (1)

zond
zond

Reputation: 1480

https://commons.apache.org/proper/commons-dbcp/configuration.html

paramenter initialSize - The initial number of connections that are created when the pool is started.

Upvotes: 2

Related Questions