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 next 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
Re: My Fast Connection Failover problem in JDBC [message #450022 is a reply to message #450020] Sat, 03 April 2010 09:50 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Do you know what is wrong ?
It might be a bug.
Submit SR to Metalink/MOS
Re: My Fast Connection Failover problem in JDBC [message #450124 is a reply to message #450022] Mon, 05 April 2010 04:16 Go to previous message
khosravi
Messages: 68
Registered: April 2006
Member
I find out the cause of problem

There are three "ons.jar" in $ORACLE_HOME the path of them are ("$ORACLE_HOME/opmn/lib/ons.jar" , "$ORACLE_HOME/ons/lib/ons.jar", "$ORACLE_HOME/oc4j/opmn/lib/ons.jar" )
if you use "$ORACLE_HOME/ons/lib/ons.jar" in your CLASSPATH it causes the error

I copied "$ORACLE_HOME/ons/lib/ons.jar" to my client application CLASSPATH path before and that was cause of the problem when I changed it with "$ORACLE_HOME/opmn/lib/ons.jar" the problem solved

And there is a point about ORACLE_HOME/opmn/conf/ons.config file it must contains "nodes" parameter

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


Current Time: Thu Mar 28 12:12:11 CDT 2024