问题描述
我正在研究一些JDBC Oracle Connection Pooling项,并遇到了一个称为通用连接池(UCP)的新Oracle池实现.现在,它使用一个新类PoolDataSource进行连接缓冲,而不是OracleDataSource [启用了缓存选项].我正在辩论是否要切换到这个新的实现,但是找不到任何有用的文档(如果有的话)来修复/升级这将给我带来的好处.任何人都有经验吗?优点/缺点?谢谢.
I was researching some JDBC Oracle Connection Pooling items and came across a new(er) Oracle Pool implementation called Universal Connection Pool (UCP). Now this uses a new class, PoolDataSource, for connection pooling rather then the OracleDataSource [with the cache option enabled]. I am debating whether to switch to this new implementation but can't find any good documentation of what (if any) fixes/upgrades this would buy me. Anyone have an experience with both? Pluses/Minuses? Thanks.
推荐答案
最新的Oracle jdbc驱动程序(11.2.0.1.0)明确声明已弃用Oracle隐式连接高速缓存(即使用OracleDataSource的那个):
Latest Oracle jdbc driver (11.2.0.1.0) explicit states that Oracle Implicit Connection cache (which is that one that use OracleDataSource) it's deprecated :
所以,我认为开始使用UCP更好,但是文档不是那么好.例如,我没有找到在Spring中使用UCP的方法...
So I think it's better to start using UCP, but the documentation it's not that good.For example I didn't find a way to use UCP with spring...
更新:我找到了正确的弹簧配置:好的,我认为我已经找到了正确的配置:
UPDATE: I've found the correct spring configuration:OK I think I've found the right configuration:
<bean id="dataSource" class="oracle.ucp.jdbc.PoolDataSourceFactory" factory-method="getPoolDataSource">
<property name="URL" value="jdbc:oracle:thin:@myserver:1521:mysid" />
<property name="user" value="myuser" />
<property name="password" value="mypassword" />
<property name="connectionFactoryClassName" value="oracle.jdbc.pool.OracleDataSource" />
<property name="connectionPoolName" value="ANAG_POOL" />
<property name="minPoolSize" value="5" />
<property name="maxPoolSize" value="10" />
<property name="initialPoolSize" value="5" />
<property name="inactiveConnectionTimeout" value="120" />
<property name="validateConnectionOnBorrow" value="true" />
<property name="maxStatements" value="10" />
</bean>
关键是指定正确的工厂类和正确的工厂方法
The key is to specify the right factory class and the right factory method
这篇关于OracleDataSource与Oracle UCP PoolDataSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!