Previous |
Next |
The Universal Connection Pool subscribes to the FAN Load Balancing events automatically when you configure fast connection failover. Instead of randomly assigning a free connection to a work request, the connection pool chooses the connect that will give the best service according to the latest information it has received. If a node becomes hung, the connection pool gradually shifts connections from the hung node to other nodes in the cluster.
To configure JDBC clients for Fast Connection Failover:
Use the Cluster Managed Services page in Oracle Enterprise Manager Database Control or Oracle Enterprise Manager Grid Control to create new services. See "Creating Services" for more information about creating services.
Enable fast connection failover for JDBC clients by setting the UCP DataSource property FastConnectionFailoverEnabled to TRUE
. Also, Configure a remote Oracle Notification Services (ONS) subscription on the JDBC client so that an ONS daemon is not required on the client, as shown in the following example:
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); Pds.setConnnectionPoolName(“FCFSampleUCP”); pds.setONSConfiguration(“nodes=docrac1:4200,docrac2:4200”); pds.setFastConnectionFailoverEnabled(true); pds.setConnectionFactoryClassName(“oracle.jdbc.pool.OracleDataSource”);
The remote ONS subscription must contain every host that the client application can use for failover.
See Also: Oracle Universal Connection Pool for JDBC Developer's Guide for more information
Set the oracle.net.ns.SQLnetDef.TCP_CONNTIMEOUT_STR
property to a nonzero value on the data source. When this property is set, if the JDBC client attempts to connect to a host that is unavailable, the connection attempt is bounded to the time specified for oracle.net.ns.SQLnetDef.TCP_CONNTIMEOUT_STR
. After the specified time has elapsed and a successful connection has not been made, the client attempts to connect to the next host in the address list. Setting this property to a value of 3 seconds is sufficient for most installations.
Configure JDBC clients to use a connect descriptor that includes the SCAN and the service name, and optionally the port that the SCAN listener listens on, for example:
@//docrac.example.us.oracle.com:1521/Sales_JDBC
Note: Do not configure Transparent Application Failover (TAF) with Fast Connection Failover for JDBC clients as TAF processing will interfere with FAN ONS processing.
In the JDBC application, you would connect to the database using a connect string, such as the following one:
pds.setURL("jdbc:oracle:thin:@//docrac.example.us.oracle.com:1521/Sales_JDBC")
If you are using a JDBC driver, you must include the complete connect descriptor in the URL because the JDBC driver does not use Oracle Net.
Make sure that both ucp.jar
and ons.jar
are in the application CLASSPATH.
About Fast Application Notification (FAN)
Configuring Clients for High Availability
Oracle Database JDBC Developer's Guide for more information about fast connection failover and configuring ONS
Oracle Database 2 Day + Java Developer's Guide for information about creating a method to authenticate users
Oracle Real Application Clusters Administration and Deployment Guide for information about configuring client failover