Wednesday, April 29, 2009

Creating Database JNDI w/o EM

Problem:
Create JNDI without using Oracle Application Enterprise Manager

Solution:
While you create Database JNDI using Oracle Application Enterprise Manager, it modifies two files in the SOA installed location.

1) data-sources.xml
2) oc4j-ra.xml

We can manually create JNDIs by adding contents to these files. This try was made just to make sure that JNDIs can be created without the help of Enterprise manager.
So here you go,

1) First you need to modify the data-sources.xml file located at <SOA_Home>\j2ee\<Active container name>\config. Open the file in notepad. Add your new pool information as:

<connection-pool name="TestPOOL">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="database username" password="database password" url="jdbc:oracle:thin:@//host name:port/service name" commit-record-table-name=""/>
</connection-pool>

Give a pool name. You need to provide the database connection details such as username, password, host name, port, service name. Save the changes.

2) As the second step, you need to modify the oc4j-ra.xml file located at <SOA_Home>\j2ee\<Active container name>\application-deployments\default\DbAdapter. Open the file in notepad. Add your new JNDI information as:

<connector-factory location="eis/DB/Test" connector-name="Test DB Adapter JNDI">
<config-property name="xADataSourceName" value="jdbc/Test"/>
<config-property name="dataSourceName" value=""/>
<config-property name="platformClassName" value="oracle.toplink.platform.database.Oracle9Platform"/>
<config-property name="usesNativeSequencing" value="true"/>
<config-property name="sequencePreallocationSize" value="50"/>
<config-property name="defaultNChar" value="false"/>
<config-property name="usesBatchWriting" value="true"/>
<connection-pooling use="none">
</connection-pooling>
<security-config use="none">
</security-config>
</connector-factory>

Provide the JNDI location and also the datasource name. Save the changes.

After the changes bounce the SOA Server. Now your database JNDI is ready to use.

4 comments:

chandu said...

Hi Abhishek,

I am new to BPEL, I was trying to invoke a stored procedure through BPEL. I created JNDI lookup just the way you have given in your blog but i am getting the following error.

file:/D:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_C_TEST_TR_F_1.3_e9d27bf51a10079ac483d85c87470e45.tmp/DB_STRPR_SERV.wsdl [ DB_STRPR_SERV_ptt::DB_STRPR_SERV(InputParameters) ] - WSIF JCA Execute of operation 'DB_STRPR_SERV' failed due to: Error while trying to prepare and execute an API.
An error occurred while preparing and executing the APPS.XX_PRC API. Cause: java.sql.SQLException: ORA-06550: line 1, column 12:
PLS-00302: component 'XX_PRC' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
[Caused by: ORA-06550: line 1, column 12:
PLS-00302: component 'XX_PRC' must be declared
ORA-06550: line 1, column 7:


I tried googlin it but invain. Appreciate your help.

Thanks
Chandra

Abhishek Saurabh said...

Hi Chandru,

By looking at the error it seems that the procedure is not working fine. Test your procedure in SQL*Plus/Toad/SQL Developer.

chandu said...

Hi Abhishek,

Thanks for the prompt reply.

I tested my procedure using sql developer. Procedure is working fine and it is in valid state.

still the same error.

Thanks
Chandra

Sen-SOA said...

Abhi,

Can you plz some highlights on similar functionality in SOA 11g? This would be very useful for the beginners like me.

Thanks,

Sen