We need the ability to failover from one database host to the other in the case that the one we’re currently connected to goes down. From what we’ve read, “Transparent Application Failover (TAF)” and “Fast Connection Failover (FCF)” are only available on Oracle 10 and higher. But our environment has Oracle 9.2.0.8.
What would be the best java solution to ensure our database connections failover? Using the oci driver seems to a better solution than the thin driver, however, we keep getting the “Unsatisfied Link Error: ocijdbc11.dll not on java.library.path”. We don’t have ocijdbc11.dll, but we do have ocijdbc10.dll in ${ORACLE_HOME}/bin
Environment:
- Database = Oracle 9.2.0.8 with a RAC supporting two servers
- Server = Solaris 10
- Clients = Windows XP, service pack 3
- JDK = 1.6.0_20
- Library = ojdbc6.jar
- Clients have Oracle thick client 10.1.0.2 installed. This gives them ocijdbc10.dll in their oracle bin directory
Our connection string in tnsnames.ora:
MY_SID =
(DESCRIPTION=
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=host1)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=host2)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=db.fully.qualified.name)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic))))
We create a datasource as follows:
- BasicDataSource ds = new
- BasicDataSource();
- ds.setUsername(“username”);
- ds.setPassword(“password”);
- ds.setUrl(“jdbc:oracle:oci:@MY_SID”);
- ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");