JDBC Connection pooling
Spring defined database connection pool
Section titled “Spring defined database connection pool”I’ve used commons-dbcp for the connection pool. testOnBorrow is true so it will automatically reconnect
in case the connection is lost.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://server.example.com/dbname"/> <property name="username" value="dbuser"/> <property name="password" value="dbpassword"/> <property name="testOnBorrow" value="true"/></bean>