OracleDataSource vs. Oracle UCP PoolDataSource(OracleDataSource 与 Oracle UCP PoolDataSource)
问题描述
我在研究一些 JDBC Oracle 连接池项目时遇到了一个新的(更)Oracle 池实现,称为通用连接池 (UCP).现在它使用一个新类 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 隐式连接缓存特性是已弃用.强烈鼓励用户使用新的 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,但是文档不是那么好.例如我没有找到将 UCP 与 spring 一起使用的方法...
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:OracleDataSource 与 Oracle UCP PoolDataSource


基础教程推荐
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01