Configuring FCF for JDBC/OCI and JDBC-Thin Driver Clients

You can enable FCF for Universal Connection Pool or Implicit Connection Cache. Oracle recommends using the Universal Connection Pool for Java because the Implicit Connection Cache is deprecated. You can also use Oracle WebLogic Server Active GridLink for Oracle RAC.

This procedure explains how to enable FCF for JDBC. For JDBC/OCI clients, if you enable FCF, then do not use the method used with Oracle Database 11g release 2 (11.2) of enabling FAN for OCI clients (setting notification to TRUE on the service), and do not configure TAF, either on the client or for the service. You can also configure Application Continuity and Transaction Guard.

To enable FCF, you must first enable the Universal Connection Pool, as described in the following procedure:

  1. Create the connection pool and set setFastConnectionFailoverEnabled(true).

    The following example creates a connection pool and enables FCF. The ucp.jar library must be included in the classpath of an application to use this example.

    PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
    pds.setFastConnectionFailoverEnabled(true);
    
  2. Determine the ports to use for Oracle Notification Service remote subscriptions.

    Use the following command to view the Oracle Notification Service configuration on each node that is running Oracle Clusterware as in the following example:

    srvctl config nodeapps -onsonly
    

    The output of this command lists the local and remote ports configured for Oracle Notification Service.

    Note:

    Oracle Notification Service configuration should have been automatically completed during the Oracle Clusterware installation.

  3. Configure the remote Oracle Notification Service subscription.

    When using the Universal Connection Pool, an application calls setONSConfiguration for an OracleDataSource instance and specifies the nodes and port numbers to use. The port numbers used for each node are the same as the remote port displayed for each node in Step 2, as shown in the following example. The ons.jar library must be included in the classpath of an application to use this example.

    pds.setONSConfiguration("nodes=racnode1:6200,racnode2:6200");
    

    Applications that use remote Oracle Notification Service configuration must set the oracle.ons.oraclehome system property to the location of ORACLE_HOME before starting the application, for example:

    java -Doracle.ons.oraclehome=$ORACLE_HOME ...
    
  4. Configure the connection URL.

    A connection factory's connection URL must use the service name syntax when using FCF. The service name is used to map the connection pool to the service. The following example demonstrates configuring the connection URL:

    pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
    pds.setURL("jdbc:oracle:thin@//SCAN_name:service_name");...

See Also: