OracleDataSource与Oracle UCP PoolDataSource [英] OracleDataSource vs. Oracle UCP PoolDataSource

查看:564
本文介绍了OracleDataSource与Oracle UCP PoolDataSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一些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 :

Oracle JDBC驱动程序版本11.2.0.1.0生产Readme.txt

此版本中有什么新内容?

通用连接池 在此版本中,Oracle隐式连接缓存功能是 不推荐使用.强烈建议用户使用新的Universal 而是连接池. UCP具有所有功能 ICC,还有更多. UCP在单独的jar文件中可用, ucp.jar.

Oracle JDBC Drivers release 11.2.0.1.0 production Readme.txt

What Is New In This Release ?

Universal Connection Pool In this release the Oracle Implicit Connection Cache feature is deprecated. Users are strongly encouraged to use the new Universal Connection Pool instead. The UCP has all of the features of the ICC, plus much more. The UCP is available in a separate jar file, ucp.jar.

所以,我认为开始使用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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆