I am using spring3 and org.apache.commons.dbcp.BasicDataSource and apache tomcat 6.x.
Once the application is started it works fine but after some time it fails to connect to database... on restart it connects again.
below is configuration used in applicationContect.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:initialSize="5" p:maxActive="15" p:maxIdle="5" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://<Host>/<schema>?useUnicode=true&" p:username="<uName>" p:password="<pwd>" p:testOnBorrow="true" p:validationQuery="SELECT 1"/>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
Can there be any problem with the configuration? Also, i am not closing/handling jdbc connections/resultset and i assume spring-jdbc will take care of it .
I am getting the below exception:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, general error