There lies a plethora of database connection pooling frameworks in the industry like Apache DBCP, C3P0, BoneCP etc., for Oracle Database. Based on my technical experience I would say The Oracle Connection pooling is the numero uno in its category and no second thought on it.
Here you go – Defining data source bean in ApplicationContext
<bean id="oracleDataSource" destroy-method="close"> <property name="URL" value="${jdbc.url}" /> <property name="user" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="connectionCacheProperties"> <props merge="default"> <prop key="MinLimit">3</prop> <prop key="MaxLimit">10</prop> </props> </property> </bean>
That’s it. Refer the oracleDataSource bean to Hibernate.
Sample definition of dataSource in Hibernate
<!-- Hibernate SessionFactory --> <bean id="sessionFactory" autowire="autodetect"> <!-- Tell hibernate to use given datasource --> <property name="dataSource" ref="oracleDataSource" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">...</prop> ... </props> </property> </bean>
Recommend for production purpose!