Monday, 22 March 2010

Universal Connection Pool (UCP) with OC4J 10.1.3.x

I setup a native OC4J 10.1.3.x Data Source using the Oracle UCP and allthough I didn't really do much more then that it did work. Personally I would stick with ICC in OC4J 10.1.3.x and the default pool implementation but if you have a pressing need to use UCP this would work.

Note: This demo is based on using stand alone OC4J so the container in this case is known as "home"

1. Ensure that the container or stand alone OC4J is using the JDBC driver. I created a shared library as follows which automatically use the latest version. For some reason the default driver won't work here.

Name: oracle.jdbc

2. I wanted to test my data source from asconsole so to do that I needed to edit the $ORACLE_HOME\j2ee\home\application-deployments\ascontrol\orion-application.xml file of the deployed ascontrol application, and comment out the line that removes the importing of the global.libraries.xml file, as shown below.

<remove-inherited name="global.libraries"/>

<import-shared-library name=""/>

3. Create a native Data Source as follows in your data-sources file.

description="UCP Native DataSource"
<property name="connectionFactoryClassName"
<property name="connectionPoolName" value="TestPool"/>
<property name="initialPoolSize" value="1"/>
<property name="maxPoolSize" value="20"/>
4. Copy ucp.jar , version, into $ORACLE_HOME/j2ee/home/applib of the container.

5. Stop/Start OC4J

6. Test the Data Source from asconsole as follows, which should then work for J2EE applications as well.


Yeu Wen Mak said...

Have you tried defining a managed data source rather than a native data source as your above example has shown?

Pas Apicella said...

You can't use a managed data source that is specifically for ICC (Implicit Connection Cache), so the only way to use UCP is as shown in this entry with OC4J 10.1.3.x.

Yeu Wen Mak said...

The reason I am looking into UCP is due to its supposedly better support for XA, and (FCF and RAC DB) integration. Without UCP, we are now using FCF with no XA. Since managed data source is required for a DB connection to participate in global transactions and UCP can only work with native data source (as you have kindly pointed out), I am basically back to square one unless we upgrade to OAS 11g (weblogic), yes?

Pas Apicella said...

Well for FMW 11g (WLS) it currently doesn't support UCP so not sure FMW 11g will do what you need here either.

Anonymous said...

Great read! You should definitely follow up to this topic!?