简体   繁体   中英

Oracle Connection Pooling in Java

I have some questions on connection pooling with java and an oracle db. From the oracle documentation for the refreshCache method

When invoked with REFRESH_ALL_CONNECTIONS, all available connections in the cache are closed and replaced with new valid physical 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. Is there something I may be missing with the purge method?

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

1) Oracle refers to the cache as the actual connection pool. There are some other caching features of the Oracle Driver, but that's not what they are referring to here.

2) Whenever I setup a connection pool, I always enable the ability to validate the connection when its borrowed from the pool. It adds a little extra latency, however it ensures I get a valid connection from the pool.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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