javaoracle10gspring-jdbcucp

Oracle FCF OSN Client Side Configuration


Good time!

First of all, here is my environment:

I need to configure the Oracle FCF feature. There are several articles about it's configuration: Spring documentation (1), complete example (2), ...

I've performed all the steps described in the article (1) and I've also configured a UCP logging where I can see that FCF is actually enabled.

What is confusing for me is the following statement fro the second article:

FAST CONNECTION FAILOVER PREREQUISITES
...

 5.) The JVM in which your JDBC instance is running must have
 * oracle.ons.oraclehome set to point to your ORACLE_HOME. For example:
 * 
 * -Doracle.ons.oraclehome=C:\oracle\product\10.2.0\db_1

...

Question:

My Oracle database (RAC) is located at a remote server and I use a thin JDBC driver, thus what should I do here (Do I really need to set uop this parameter, and, if yes, than how)? There is no point in the first article about configuring such a JVM parameter, it is only said that I need to set up the 'ONSConfiguration' parameter of a datasource where I should list all the RAC nodes...

UPDATE 1:

Also from the second article:

CLIENT-SIDE ONS CONFIGURATION
...
(2) ONS daemon on the client side
Example ons.config file for a client:
...

At the beginning of this article it is said that the 'client-side' is a java-based application, while the 'server-side' is a database (RAC). It is really required to creare the 'ons.config' file on a java-based-application-side in case of using a thin JDBC driver?

UDPADE 2: From the Oracle documentation:

Remote Configuration

UCP for JDBC supports remote configuration of ONS through the SetONSConfiguration pool property.    The ONS property value is a string that closely resembles the content of an ons.config file. The string contains a list of name=value pairs separated by a new line character (\n). The name can be: nodes, walletfile, or walletpassword. The parameter string should at least specify the ONS configuration nodes attribute as a list of host:port pairs separated by a comma. SSL would be used when the walletfile attribute is specified as an Oracle wallet file.

Applications that use remote 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 ...

But how can I set the ORACLE_HOME variable when I have no local installation of Oracle database, that is what the thin driver is about, right?


Solution

  • If you want only use UCP pool , then you just need this setup :

    PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
    pds.setONSConfiguration("nodes=10.247.43.111:4500, 10.247.43.112:4500");
    pds.setFastConnectionFailoverEnabled(true);
    

    where "nodes=10.247.43.111:4500, 10.247.43.112:4500" is list of ons listerers

    10.247.43.111:4500 - remote ons listerner on node1
    10.247.43.112:4500 - remote ons listerner on node2
    etc.

    see this good example:

    http://www.idevelopment.info/data/Programming/java/jdbc/High_Availability/FastConnectionFailoverExampleThin.java

    and this http://docs.oracle.com/cd/B19306_01/java.102/b14355/fstconfo.htm#CEGGDDFJ

    ORACLE_HOME needed for local ONS demon connection.