简体   繁体   English

Java中的Oracle连接池

[英]Oracle Connection Pooling in Java

I have some questions on connection pooling with java and an oracle db. 我对与Java和oracle db的连接池有一些疑问。 From the oracle documentation for the refreshCache method 从oracle文档获取refreshCache方法

When invoked with REFRESH_ALL_CONNECTIONS, all available connections in the cache are closed and replaced with new valid physical connections. 当用REFRESH_ALL_CONNECTIONS调用时,将关闭缓存中的所有可用连接,并用新的有效物理连接代替。

The phrase 'all available connections in the cache' does this refer only to inactive connections or all connections whether active or not? 短语“高速缓存中的所有可用连接”是否仅指无效连接或所有连接(无论是否处于活动状态)?

Secondly having purged a cache so there are no connections in the cache, the next time I call the getConnection method I get a closed connection. 其次,清除缓存后,缓存中将没有连接,下次我调用getConnection方法时,将获得封闭的连接。 Is there something I may be missing with the purge method? 使用清除方法可能会缺少一些东西吗?

http://docs.oracle.com/cd/B14117_01/java.101/b10979/conncache.htm http://docs.oracle.com/cd/B14117_01/java.101/b10979/conncache.htm

1) Oracle refers to the cache as the actual connection pool. 1)Oracle将缓存称为实际连接池。 There are some other caching features of the Oracle Driver, but that's not what they are referring to here. Oracle驱动程序还有其他一些缓存功能,但这不是它们在这里指的。

2) Whenever I setup a connection pool, I always enable the ability to validate the connection when its borrowed from the pool. 2)每当我建立连接池时,我总是启用从连接池借用连接时对其进行验证的功能。 It adds a little extra latency, however it ensures I get a valid connection from the pool. 它增加了一些额外的延迟,但是可以确保我从池中获得有效的连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM