Hello
I have, I might say, a quite a big issue.
I'm working on Java web application which use springs BasicDataSource to setup DB connection. I was testing the application locally and it works just fine... but, when application is online, connection to DB in some point just stuck. I was than investigating regarding connection pooling, and I figure it out that on each new HTTP request, where I have some of the queries executed, new pool is created. As I know, pooling is introduced to be reusable, and not created the each time when new DB access is involved. Or I'm wrong?
Here is my spring datasource config:
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="url"/>
<property name="username" value="username"/>
<property name="password" value="password"/>
<property name="defaultAutoCommit" value="true"/>
<property name="defaultTransactionIsolation" value="1"/>
<property name="initialSize" value="0"/>
<property name="maxActive" value="20"/>
<property name="minIdle" value="0"/>
</bean>
Than I have configured:
<bean id="EventDao" class="my.managament.database.class">
<property name="dataSource" ref="dataSource"/>
</bean>
And mainPageController which handles all HTTP requests sent to application
<bean id="mainController" class="my.management.main.controller.class">
In the rest of application, I use gedDatabase() to acquire DB connection, and do select through JDBCTemplate.
Where am I getting wrong?
Thanks