Pages

Subscribe:

Ads 468x60px

Tuesday 11 December 2012

Implicit Connection Cache



Implicit Connection Cache called as ICC in Oracle RAC. ICC is an advanced JDBC 3.0–compliant connection cache completion for DataSource, which can position to dissimilar fundamental databases. The cache is facilitated by invoking setConnectionCacheEnabled(true) on OracleDataSource. Cache is generated when the first correlation is demanded from the OracleDataSource. ICC produces and preserves physical connections to the database and enfolds them with logical connection. One cache is enough to service all connection requests, and any number of caches can be generated. Preferably, more than one cache is produced when there is necessitate accessing more than one DataSource. While the ICC creates and preserves physical connections to the database, the Connection Cache Manager creates the cache and administers the connection demands to the cache. ICC provides a number of advantages:

It can be employed with both thin and OCI drivers.

OCI clients can register to accept notifications about RAC high availability occurrences and respond when events occur.

During DOWN event giving out, OCI ceases affected connections at the client.

Eliminates connections from the OCI connection pool and the OCI session pool-the session pool maps each session to a physical connection in the connection pool, and there can be multiple sessions per connection.
Another feature is Fails over the connection if TAF has been arranged. If TAF is not configured, then the client only receives an error.

OCI does not currently handle UP events.

There is a one-to-one mapping between the OracleDataSource instance and the cache. When the application call ups the close()method to close the connection, all connections acquired through the datasource are revisited to the cache for reuse. The cache either returns an existing connection or creates a new connection.

The connection cache holds all properties specified by the JDBC 3.0 connection pool specification. The support for these properties allows the application to fine-tune the cache to maximize the performance for each application.

It also supports a mechanism to recycle and refresh stale connections. This helps refresh old physical connections.
Only one cache manager is present per virtual machine (VM) to manage all the caches. The Oracle Connection Cache Manager provides a rich set of APIs to manage the connection cache.

It provides a connection cache callback mechanism. The callback feature provides a mechanism for users to define cache actions when a connection is returned to the cache, when handling abandoned connections, and when a connection is requested but none is available in the cache.

Public boolean handleAbandonedConnection(OracleConnection oracleConnection, Object 0): This function is called when a connection is abandoned.

Public void releaseConnection(OracleConnection oracleConnection, Object o: This function is called when releasing a connection. 

This mechanism offers the capability for the application to describe the cache performance when the events occur.

It supports user-defined connection attributes that conclude which connections are retrieved from the cache. The user characteristics are a name-value pair and are not validated by the implicit connection cache.
There are two methods can retrieve connections based on these properties:
getConnection(java.util.Properties
cachedConnectionAttributes)
getConnection(java.lang.String user, java.lang.String passwd,
java.util.Properties cachedConnectionAttributes)