Problem Statement: Configure Oracle Connection Pool in Spring
This is basic data source (Only testing)
<bean id="datasource1"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>ORACLE URL</value>
</property>
<property name="username">
<value>user id</value>
</property>
<property name="password">
<value>user password</value>
</property>
</bean>
This is dbcp data source (Preferred for Testing.)
<bean id="datasource2"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>org.apache.commons.dbcp.BasicDataSource</value>
</property>
<property name="url">
<value>ORACLE URL</value>
</property>
<property name="username">
<value>user id</value>
</property>
<property name="password">
<value>user password</value>
</property>
<property name="initialSize" value="5"/>
<property name="maxActive" value="20"/>
</bean>
This is Oracle Connection Pool (Production Quality)
<bean id="connectionPool1" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
<property name="connectionCachingEnabled" value="true" />
<property name="URL">
<value>ORACLE URL</value>
</property>
<property name="user">
<value>user id</value>
</property>
<property name="password">
<value>user password</value>
</property>
<property name="connectionCacheProperties">
<value>
MinLimit:1
MaxLimit:5
InitialLimit:1
ConnectionWaitTimeout:120
InactivityTimeout:180
ValidateConnection:true
</value>
</property>
</bean>
Oracle Connection Pool is better than DBCP and C3P0
-o-
select * from v$version;
“BANNER”
“Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production”
“PL/SQL Release 11.2.0.1.0 – Production”
“CORE 11.2.0.1.0 Production”
“TNS for Linux: Version 11.2.0.1.0 – Production”
“NLSRTL Version 11.2.0.1.0 – Production”
Go to Oracle and Choose correct Driver and Download it.
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html
Option 1: Added to Maven Repo and pom.xml
Add jar to maven Repo
http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
Refer it in pom file.
<project ...>
<dependencies>>
<!-- ORACLE database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
</dependencies>
</project>
Option 2: Add the jar file to Lib folder.
#oracle-jdbc-pool-oracledatasource