This blog gives you a detailed approach to configure a DataSource, JNDI, DBAdapter, and its underlying technologies, facts and common issues.
Every single component used in a SOA Application has to be a service, and this applies to the database also. A database by itself cannot act as a service that can be exposed to the service. Inorder to use the database in a SOA application, you need to expose it as a service in some way.
Oracle SOA Suite provides you this capability by using a JCA-build wrapper called the DBAdapter.
Using this adapter in your application is quite straight forward, provided it is configured correctly.
Many times, developers come across errors like
Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections.
The invoked JCA adapter raised a resource exception.
Please examine the above error message carefully to determine a resolution.
while working with the DBAdapters. This is due to incorrect setup of the adapter.
Datasource setup is a one time step, and it is always good to know the underlying steps and technologies involved.
Before we go to the steps in configuring a DBAdapter, lets have a look at the various concepts involved in this.
A datasource, as its name implies, is anything that acts as a source for data. Database is a source of data, and it has to be configured as a datasource to the SOA infrastrucure.
Datasource in specific to the Weblogic Server is the connection to the actual underlying data provider.
WebLogic communicates with the database through a connection pool. The connection pool enables WebLogic to use a fixed number of connections to databases rather than incur the overhead of constantly creating and disposing of connections.
A data source has a connection pool attached to it, which it uses for connecting to the actual data provider(Database in this case). While creating a datasource, you give a JNDI name, which is used by the JNDI infrastructure to call the datasource.
JNDI, the Java Naming and Directory Interface is a standard interface for the Java based application clients to access the underlying naming and directory services.
This forms a wrapper over the underlying naming and directory services like DNS, LDAP, etc. and lets the client access different services in a standard way.
JNDI is independent of any specific naming or directory service implementations, and allows any service provider implementations to be plugged into the JNDI framework using the standard Service Provider Interface(SPI).
There are basically 3 steps inorder to setup and configure a DBAdapter in a SOA Application.
- Configure a datasource for the underlying database, associate a JNDI name to it.
- Configure an outbound connection pool, and link it with the datasource using the same JNDI name.
- Use this JNDI name while configuring the DB Adapter.
Step 1 : Configure a Datasource for the underlying Database, associate a JNDI name to it
This step is done using the Weblogic Admin Console. Please make sure your database is up and running before this step.
Soa_domain --> Services --> Data Sources --> New --> Generic Data Source -->
Standard naming convention for database sources would have a JNDI name prefixed with "jdbc/". You will use this name later to associate a connection pool to this datasource.
Select the appropriate driver
Give the underlying Database details, test the connection in the next screen(not shown here)
Select the server that is running the SOA infrastructure. This makes this datasource to run on that particular server, making this available to all the apps running on that server
Click on finish. After this, you should see this newly configured datasource in the Data Sources summary screen.
Now that the datasource is setup, and a JNDI name associated to it,
you need to create a connection pool for this datasource, in other words connections to this database.
Step 2 : Configure an outbound connection pool, link it to the datasource using the JNDI name
In Weblogic Admin Console,
soa_domain --> Deployments --> dbAdapter --> Configuration --> Outbound Connection Pools --> New
In the above screen, you are giving a new JNDI name, and this will be used in the SOA Suite's DBAdapter configuration wizard to obtain reference to this connection pool.
Now, you can see the newly configured JNDI name in the list of Outbound Connection Pools.
This new connection pool has to be linked to the datasource that you've created before.
There might be a bit confusion in the JNDI names. Here is how it is.
Both the datasource and Connection Pool has their specific JNDI Names
Datasource myDataSource has a JNDI Name
Connection Pool has a JNDI Name
myConnPoolForDB, and this connection pool will use the name jdbc/myDataSource as its xaDataSourceName, and hence the linking to the datasource is done
After this setup, you need to redeploy the dbAdapter
Select the DBAdapter in deployments, Update-->Redeploy
Step 3 : Use this JNDI name while configuring the DB Adapter
While setting up the DBAdapter in the SOA Suite, in the configuration wizard, use the same JNDI Name
I Hope it is clear now what all goes into a dbAdapter setup.
My next post explains about working with a DatabaseAdapter in Oracle SOA Suite 11g
Thanks for going through my post, feel free to provide a feedback!
Excellent Article! expecting more from you like this. Very lucid explanation, don't have to read several pages Oracle documentation to clear a simple concept. Keep it up, great work!ReplyDelete
Excellent, thank you.ReplyDelete
Right on the Mark! Very helfpful, concise and informative article that got me over my config. hurdle and back into developing. Thank You!ReplyDelete
I completly agree. I am new to SOA-BPEL tool and your blog given complete knowledgeReplyDelete
Excellent Article! expecting more from you and expecting JMS and AQ AdapterReplyDelete
This was a very helpful demonstration. Thanks.ReplyDelete
Thanks a lot.... Your post cleared most of my doubts regarding Datasource.ReplyDelete
Nice Article..Thank youReplyDelete
Really its a powerful set of Nice Articles on SOA. I myself read these articles and also suggested my colleagues to read them for our project work.ReplyDelete
Have gone through many articles, this stands top amongst all, great work !!ReplyDelete
very very helpful article....I went through various articles...but this seems to the best article..Thank you so muchReplyDelete
I am so happy to find your article. Nothing could be better. :)ReplyDelete
Keep up the good work. Thanks.
Very good Article. Thank you RaviKiranReplyDelete
very useful. Exactly same as expected. Thank you. :)ReplyDelete
Cannot expect a better explanation.ReplyDelete