Thursday, August 6, 2015

Difference between WebLogic Server "DbAdapter" and "Data Source" connection pool parameters

For users of Oracle SOA Suite 11g/12c, this blog will attempt to answer whether you should configure your connection pool settings at the adapter level or at the data source level.


Data Source Settings

On Oracle WebLogic Server 11g/12c, navigate to Data Sources > SOADataSource > Configuration > General.

Here, you can obtain the JNDI, such as jdbc/SOADataSource. This JNDI is generally handed to your developers so that they can use it from within their Java code. Keep in mind that this JNDI is also used by the DbAdapter (explained later).


Now click on the Connection Pool tab. Here, you can see the various settings of the connection pool such as the initial and maximum number of connections which you can adjust as necessary.



DbAdapter Settings

Now navigate to Deployments > DbAdapter > Configuration > Outbound Connection Pools > [expand javax.resource.cci.ConnectionFactory] > eis/DB/SOADemo > General. Here, you can obtain the JNDI, such as eis/DB/SOADemo, which is passed on to your SOA developers. Your SOA developers typically use this from within their SOA or OSB code.

(Note that Oracle SOA Suite deploys various JCA adapters as part of the installation of the product.)



Now click on the Properties tab. As you can see here, the connection factory is really based off of the data source (i.e., you are required to reference a data source).



Finally, click on the Connection Pool tab. Here, you also have initial and maximum connection pool settings which you can adjust as necessary.



The Question

The "Max Capacity" setting under the connection factory's connection pool is set to 1000 and under the data source's connection pool is set to 20. Which one actually takes effect?



The Explanation

The JCA connection factory settings and data source settings are totally different settings.

JCA connection pools are to connect to JCA Adapters (such as the DbAdapter, JmsAdapter, etc.). Data Source connection pools are to connect to the database.

When the "Max Capacity" setting under the connection factory's connection pool is set to 1000, this means that you have 1000 available connections to connect to the JCA adapters. This means that your SOA or OSB code has up to 1000 connections to the JCA adapter (not the database).

When the data source's connection pool is set to a maximum value of 20, this means that you have a maximum of 20 connections to connect to the Database.

Generally, the default settings of the JCA connection factory should be sufficient. However, you may need to adjust your Data Source connection pool settings depending on your needs.



Applicable Versions:
  • Oracle WebLogic Server 11g/12c
  • Oracle SOA Suite 11g/12c


6 comments:

Unknown said...
This comment has been removed by the author.
Unknown said...

Hi Ahmed,

Could you please explain to me the below Queries.

Datasource is also providing the connection to the DB thenwWhy we are using DBAdapter instead of the Datasource in SOA services for connecting to the DB?

Thank and Regards,
Ramesh

Ahmed Aboulnaga said...

In your SOA code, you have no choice but to use the DBAdapter.

With that being said, reread the section titled "The Explanation" in the blog post which explains the difference. If it's still not clear, let me know. I'll admit it's a bit confusing at first.

Thanks.

Unknown said...

Hi Ahmed,

Thanks for the information...

Thanks and Regards,
Ramesh A

Jagjeet said...

So If we are using SOA/OSB Web Service to invoke Database Procedure or running some Database queries and if we are using DB Adapter (JCA) to connect to Database then
SOA/OSB can send max. 1000 concurrent request to JCA (as 1000 JCA Max Capacity) and internally JCA we using Maximum 20 Physical connection to connect to database (as 20 Data source Max Capacity) so for the remaining 980 requesta either will wait or get some error. Is my understanding correct?

Saurabh Jha said...

Hi Ahmed,

We are getting below error, can you please let me know if error is caused because of exhaustion of pool connections of data source or db adapter.

Internal Exception: weblogic.jdbc.extensions.PoolDisabledSQLException: weblogic.common.resourcepool.ResourceDisabledException: Pool DataSource is suspended. Cannot allocate resources to applications. It was suspended at Thu Feb 21 12:45:59 IST 2019 because of 2 consecutive connect failures. Last connect attempt failed at Thu Feb 21 12:46:06 IST 2019 because of weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: IO Error: Socket read timed out. Last connection created successfully at Thu Feb 21 12:45:52 IST 2019.