Search code examples
javaoraclefailover

java connection string to support oracle TAF feature


We are currently using Spring JDBC with connection pool implementation from DBCP to connect to TAF supportred ORACLE 11g2 server.

connection string used is

jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST 
                     =(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS = (PROTOCOL = TCP)(HOST = **IP1**)(PORT 
                     = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = IP2)(PORT = 1521)))(CONNECT_DATA 
                     =(SERVER = DEDICATED)(SERVICE_NAME = **service_name**)(FAILOVER_MODE=(TYPE=select)(METHOD=basic))))

When querying v$session to verify failover type ,failover method . It is showing both to none. enter image description here

What should be done to set failover_type and failover_method to SELECT and BASIC respectively. enter image description here

Is there any invalid settings in connection string please suggest. Thanks in advance.


Solution

  • The 11.2 oracle jdbc documentation says "Transparent Application Failover (TAF) is a feature of the Java Database Connectivity (JDBC) Oracle Call Interface (OCI) driver" your connection string is: jdbc:oracle:thin: So in order to enable TAF you should use the jdbc OCI driver not the thin one. I never used the jdbc OCI driver but I suppose you must install the standard native oracle client or the instant client.