Home » Open Source » Programming Interfaces » My Fast Connection Failover problem in JDBC
My Fast Connection Failover problem in JDBC [message #450020] Sat, 03 April 2010 09:40 Go to previous message
khosravi
Messages: 68
Registered: April 2006
Member
Hello

I wanna use FCF in my application (I don't use OC4J or other Application servers my application is a client java application that connects to database directly) , I have established RAC (Oracle 11g R2) , I have two nodes

The steps that I have done are :

1- I set the structure of "$ORACLE_HOME/opmn/conf/ons.config" files in two nodes like this :

localport=6150
remoteport=4200
allowgroup=true
usesharedinstall=true

2- Then I started ONS by this "$ORACLE_HOME/opmn/bin/onsctl start" command (the "onsctl ping" on every node shows that ONS is running)

3- I ran the "/u01/app/11.2.0/grid/bin/racgons.bin add_config ser1:4200 ser2:4200" command

4- I use this application for connecting to my service:
import java.sql.*;
import java.util.Properties;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;

public class FCFConnection {
public FCFConnection() {
}
public static void main(String[] args) throws Exception{
OracleDataSource ods = new OracleDataSource();
ods.setUser("system");
ods.setPassword("ali120");
ods.setConnectionCachingEnabled(true);
ods.setConnectionCacheName("MyCache");
ods.setFastConnectionFailoverEnabled(true);
ods.setONSConfiguration("nodes=ser1:4200,ser2:4200");
ods.setURL("jdbc:oracle:thin:@(DESCRIPTION= (LOAD_BALANCE=on)" +
"(Address=(PROTOCOL=TCP)(HOST=scan)(PORT=1521))" +
"(CONNECT_DATA=(service_name=ali_service1.com)))");
Connection conn = ods.getConnection();

}
}


But when I run the application I get this error (ons.jar is added to my CLASSPATH):

Exception in thread "main" java.lang.IllegalAccessError: tried to access method oracle.ons.ONS.<init>(Ljava/lang/String;)V from class oracle.jdbc.pool.OracleConnectionCacheManager$1
at oracle.jdbc.pool.OracleConnectionCacheManager$1.run(OracleConnectionCacheManager.java:250)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.pool.OracleConnectionCacheManager.createCache(OracleConnectionCacheManager.java:242)
at oracle.jdbc.pool.OracleDataSource.cacheInitialize(OracleDataSource.java:391)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:372)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:178)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:156)
at rac.FCFConnection.main(FCFConnection.java:28)

( but if I remove the "ods.setFastConnectionFailoverEnabled(true);" line from application all thing is ok and the connection is established)

Do you know what is wrong ?

thank you
 
Read Message
Read Message
Read Message
Previous Topic: Oracle SQL parallel query within PERL
Next Topic: odp .net 64bit problem
Goto Forum:
  


Current Time: Fri Apr 26 15:41:56 CDT 2024