Friday, September 12, 2008

Database Adapters JNDI name in JDev and Application server

Why I used it?

Well in all 3 of big projects that I worked in, Db adapters was required. I had no choice but use it.

Why JNDI?

Well JNDI itself provides one level of indirection from the physical database connection. 
Decouples the actual database connection code from the application logic. 
If you are thinking cut the theory and tell me the real thing, how to do this in BPEL, that's exactly what I am about to do.

Where is this done for DBAdapter?

If you had a look at DB Adapter, JNDI is a configuration that comes up while following the wizard for DBAdapter. Now where the hell did I set up JNDI connections and how will AS (application server [for those who might not guess AS is this]) figure this out.

Well actually you need to do this in 2 places. One in DBAdapter and another in AS.

Why I need this in AS?

Well how can AS figure out which database and other connection details. 
What else but you need to do this in application server as well!
If you are asking what all I need to setup in AS just read on!!

What is the order to do this?

Both of these are independent and can be done in any order. (By both I mean JDev setup and AS setup)
Just be sure that both of these are done before you execute any code in BPEL else your opmn logs will show thing that you never like to see, ERRORS.

How to relate them? Whatz this use the same name thing?

Both the JDev and AS JNDI names should be the same or else AS will not be able to relate these together.

What's the AS setup?

There are 3 basic things that need to be setup in AS before AS JNDI can be used.
Number 1 the physical connection pool with all the service details.
Number 2 the Data source that points to the connection pool.
Number 3 setup the JNDI name as in JDev and pointing to the Data Source.

What do I setup in JDev?

In the connections in JDev create a connection to the database that was created in AS connection pool. Else you will not be able to explore the stuff in the Database.

What is with this mcf thing?

If you setup connection in JDev there is some thing that comes on board but not directly visible.
What else but the mcf properties.
Does not harm anything but if the JNDI are missing in AS starts using this to connect.
So for production it is best that these mcf details are removed.
If you don't know that where it is located just create a project with JNDI see it for your self.
It will be present in the Database Adapter generated files. Do you want clues!! I guess not.

2 comments:

Sridhar Yerram said...

Can you tell me more about AS setup !!!
i created a connection pool :DBConnection1
and i created a connection factory as : eis/DB/DBConnection1

but still iam unable to succeed.
i removed the mcf properties from my wsdl file.

iam getting the following error :




Unable to parse jca:address; nested exception is:
ORABPEL-12511
Adapter Framework unable to create outbound JCA connection.
file:/D:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_AdapterProcess_1.0_7dc192de7b9309bf2a5733e111075804.tmp/GetSQDBAdapter.wsdl [ {http://xmlns.oracle.com/pcbpel/adapter/db/GetSQDBAdapter/}GetSQDBAdapter_ptt ]: : The Adapter Framework was unable to establish an outbound JCA connection due to the following issue: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Please examine the log file for any reasons. Enable DEBUG logging in the BPEL Console.

Anonymous said...

Plz don't waste our time.Make a useful blog,instead wasting everybody's time