Java – Oracle – pool connected to spring framework

We are trying at @ L_ 301_ Implement Oracle connection pool with the help of 0 @ framework We are using the DBCP connection pool method However, the integration between DBCP and spring is not so good

The problem we face is that DBCP returns the poolableconnections object, while Oracle expects the oracleconnection object (ClassCastException thrown)

It appears that this issue has been addressed in Oracle 11g But I'm curious about how others use the spring framework to implement Oracle connection pooling for Oracle 10g (using Tomcat)

We use ibatis as the ORM framework

I believe there is a way Any help is appreciated

Solution

I will use the solution provided by oracles, which is included in their ojdbc tank The older method was to use the class oracleconnectionpooldatasource, but now you can set parameters on a regular oracledatasource and get the connection pool

Here's how to do this in spring:

<bean id="datasource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
   <property name="connectionCachingEnabled" value="true" />
   <property name="URL" value="${jdbc.url}" />
   ...all your connection properties
   <property name="connectionCacheProperties">
      <props merge="default">
         <prop key="MinLimit>3</prop>
         <prop key="MaxLimit">20</prop>
      </props>
   </property>
</bean>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>