vladmihalcea/flexy-pool

Does flexy-pool supports DB2 and Oracle Datasources?

Ahmed-A-Syed opened this issue · 10 comments

We uses the below connection pools in our application

  1. DB2DataSource 2) OracleDataSource

Does current flexy-pool supports DB2 and Oracle Datasources?
Can we implement flexypool metrics and failover strategies to the above connection pools?
I didn't find any specific doc or example code related to it under vladmihalcea's flexypool github repository.

Could you please suggest on this?

FlexyPool supports the most common Java connection pools. I'm not sure if DB2DataSource or OracleDataSource provide connection pooling capabilities.

You can always use the flexy-java-ee for any generic DataSource, which will provide metrics without fallback.

For fallback, you need to translate the timeout exception and be able to set the max pool size. Something like this AtomikosPoolAdapter.

So, it's very easy to provide two new adapters for Oracle and DB2. Send me a Pull Request if you do it, and I will integrate it.

I didn't get u...! could you please explore a bit more
my current configuration is like below. i want to have flexypool features dynamic connection pool setings, monitoring, fallback etc;
what all changes are to be done from my side to get flexypool benefits?

   <bean id="ds" class="com.ibm.db2.jcc.DB2DataSource">
    <property name="user" value="${db2User}" />
       .......
               .......
               .......
</bean> 


<bean id="db2ConnFactory" class="org.apache.commons.dbcp.DataSourceConnectionFactory">
    <constructor-arg ref="ds" />
</bean> 

First of all, com.ibm.db2.jcc.DB2DataSource does not support connection pooling at all.

What you need to do is use HickariCP to wrap the com.ibm.db2.jcc.DB2DataSource. FlexyPool supports KikariCP as illustrated in the Installation Guide.

You can take a look on these Spring configurations folder for a way to integrate HikariCP with FlexyPool.

It's very easy.

we already have a connection pool like below:

   <bean id="db2ConnPool" class="org.apache.commons.pool.impl.GenericObjectPool"
    destroy-method="close">
    <property name="maxActive" value="40" />
    .......
    .......
    .......
    </bean>

I guess you are using DBCP, in which case it's better to use BasicDataSource as suggested in the Installation Guide. FlexyPool doe snot support Common Pools directly without DBCP.

Yes..but we were not using BasicDataSource, PoolingDataSource is being used. Can I use flexy pool with PoolingDataSource the similarway mentioned in above BasicDataSource installation guide

<bean id="pooledDB2DS" class="org.apache.commons.dbcp.PoolingDataSource">
    <constructor-arg ref="db2ConnPool" />
</bean>

ObjectPool is not currently supported, so FlexyPool does not support PoolingDataSource either.

You can add support for it and send me a Pull Request, or you can switch to using a BasicDataSource.

ok. will try to check the above options. anyway thanks for the quick response and info.

You're welcome.

Closed.