Configuring FAN for Java Clients Using Universal Connection Pool

Oracle recommends that you use the Universal Connection Pool (UCP) or WebLogic Server Active GridLink to take full advantage of Fast Connection Failover (FCF) with the database JDBC Thin Driver.

To enable Fast Connection Failover (FCF), set the UCP pool property FastConnectionFailoverEnabled on the Universal Connection Pool. You do not need to configure this property for Active GridLink, because it enables FCF by default. Third-party application servers, including IBM WebSphere and Apache Tomcat, support UCP as a connection pool replacement.

To learn how to embed UCP with other web servers, refer to the following technical briefs:

Follow these configuration steps to enable Fast Connection Failover.

  1. Use the service name syntax for the connection URL. Oracle recommends that you specify a dynamic database service name, using the appropriate JDBC URL structure.

    Ensure your URL format supports high availability. You can use either a Java Thin driver (JDBC Thin), or use an Oracle JDBC OCI driver.

  2. If wallet authentication has not been established, then you must set up remote ONS configuration.

    Set the pool property setONSConfiguration in a property file. The property file must contain an ons.nodes property. You also have the option to set properties for oracle.ons.walletfile and oracle.ons.walletpassword.

    The following is an example of an ons.properties file:

    PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
    pds.setConnectionPoolName("FCFSamplePool"); pds.setFastConnectionFailoverEnabled(true);
     pds.setONSConfiguration("propertiesfile=/usr/ons/ons.properties");
    pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
    pds.setURL("jdbc:oracle:thin@((CONNECT_TIMEOUT=4)(RETRY_COUNT=30)(RETRY_DELAY=3) "+ "
     (ADDRESS_LIST = "+ " (LOAD_BALANCE=on) "+ " ( ADDRESS =
     (PROTOCOL = TCP)(HOST=GSM1)(PORT=1522))) "+ " (ADDRESS_LIST = "+ " (LOAD_BALANCE=on)
     "+ "( ADDRESS = (PROTOCOL = TCP)(HOST=GSM2)(PORT=1522)))"+
     "(CONNECT_DATA=(SERVICE_NAME=service_name)))");
  3. Ensure that the pool property setFastConnectionFailoverEnabled=true is set.
  4. Ensure that the CLASSPATH includes ons.jar, ucp.jar, and the JDBC driver JAR file, such as ojdbc8.jar.
  5. If you use JDBC Thin with your database, then you can configure Application Continuity to fail over the connections after the FAN event.
  6. If your database requires custom ONS endpoints instead of the default autoconfiguration, then enable the appropriate ONS endpoints manually.

    If multiple clusters exist with auto-ons enabled, then auto-ons generates node lists using the following rule:

    By default, oracle.ons.maxconnections is set to 3 for every active node list. Typically, you do not need to set this value explicitly, or change this value. In this example, the ONS client tries to maintain six connections in total.

Related Topics

Parent topic: Application Development Considerations