Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: failover JDBC thin driver connection in 10.2 RAC
cbarak wrote:
> Thanks, Joe. I got past the error message per your suggestion. However,
> I'm still not able to transparently failover my session using JDBC thin
> driver/FCF. I may have misunderstood what was being conveyed in this
> thread. Is it possible to transparently
> failover a JDBC thin client connection using FCF?
>
> I did a test where my java program connected to the database and
> queried on a data dictionary view. When I "shutdown abort" on the
> instance, the session failed with the following error messages. The
> java program ran on one of the RAC nodes. I've configured connection
> cache, FCF and ONS. I'm not sure what else that I've missed.
>
> Any suggestions?
>
> thanks.
>
> Exception in thread "main" java.sql.SQLException: No more data to read
> from socket
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
Hi. You probably don't have FCF set up well, or else you should have
received
a better, more informative exception. However, there is nothing you can
do to
reliably be blind to DBMS failovers. Your code will have to close the
current,
dead connection and ask the driver for a new one, the same way you got
the
first. If your URL is correct, describing other RAC nodes and asking
for
failover, then the driver will get you a new good connection.
To reiterate, nothing can guarantee that a query will always complete
if the
DBMS gets cut off in the middle of it. You will have to expect and
handle an
exception, make a new connection and reissue the query. TAF promised
it,
but failed, and FCF just lets you know a failover happened, and in some
failure cases where you might have hung for minutes on a dead socket,
FCF
will make the exception come quickly.
Joe Weinstein at BEA Systems
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
> at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
> at
> oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118)
> at
> oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
> at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:478)
> at
> oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
> at
> oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:790)
> at
> oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
> at
> oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:830)
> at
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
> at
> oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1272)
> at test4.main(test4.java:40)
>
>
>
>
>
>
> joeNOSPAM_at_BEA.com wrote:
> > Download Oracle's ons.jar and get it into your classpath.
> >
> > Joe Weinstein at BEA Systems
> >
> > cbarak wrote:
> > > thanks everyone for their inputs.
> > >
> > > I've created an oracle data source in my java program and enabled
> > > caching and FCF -
> > > ods.setConnectionCachingEnabled(True);
> > > ods.setFastConnectionFailoverEnabled(True);
> > >
> > > however when I tried executing the program, I kept gettting
> > > NoClassDefFoundError: oracle/ons/ONSException. Are there any other
> > > classes I have to include other than the following -
> > >
> > > import java.sql.*;
> > > import oracle.jdbc.driver.*;
> > > import oracle.jdbc.pool.*;
> > >
> > >
> > > Exception in thread "main" java.lang.NoClassDefFoundError:
> > > oracle/ons/ONSException
> > > at
> > > oracle.jdbc.pool.OracleConnectionCacheManager.createCache(OracleConnectionCacheManager.java:261)
> > > at
> > > oracle.jdbc.pool.OracleConnectionCacheManager.createCache(OracleConnectionCacheManager.java:167)
> > > at
> > > oracle.jdbc.pool.OracleDataSource.cacheInitialize(OracleDataSource.java:427)
> > > at
> > > oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:402)
> > > at
> > > oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:189)
> > > at
> > > oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)
> > > at test1.main(test1.java:20)
> > >
> > >
> > > thanks.
> > >
> > >
> > > kuassi.mensah_at_gmail.com wrote:
> > > > I confirm, FCF is driver-independent while TAF is an OCI feature and
> > > > can only be used with JDBC-OCI. FCF requires the application or the
> > > > container to re-submit a getConnection() request upon RA node failure,
> > > > which is a good JDBC coding practice -- while this happens
> > > > transparently with TAF however, TAF is not integrated with the
> > > > connection pool and certain features do not work as people would think.
> > > > I cover in greater details FCF and compare with TAF in my book
> > > >
> > > > Kuassi - blog http://db360.blogspot.com/
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > DA Morgan wrote:
> > > > > cbarak wrote:
> > > > > > I have problem failing over JDBC (thin driver) connection using TAF:
> > > > > >
> > > > > > Connection conn = DriverManager.getConnection
> > > > > > ("jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
> > > > > > dhp1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =
> > > > > > dhp2-vip)(PORT =1521)) (ADDRESS = (PROTOCOL = TCP)(HOST =
> > > > > > dhp3-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER =
> > > > > > DEDICATED) (SERVICE_NAME = ypapps) (FAILOVER_MODE = (TYPE = SELECT)
> > > > > > (METHOD = BASIC) (RETRIES = 180) (DELAY = 5))))","scott","tiger");
> > > > > >
> > > > > >
> > > > > >>From the many threads I have read, some folks were able to use TAF for
> > > > > > JDBC thin client connections in 10gr2. Are there any specific
> > > > > > configuration I have to set up for JDBC thin client to make failover
> > > > > > transparent?
> > > > > >
> > > > > > I have also read from Oracle manuals that Fast Connection Failover is
> > > > > > the preferred method for jdbc connection. How do I turn on FCF - ie
> > > > > > where do I set FastConnectionFailoverEnabled=true? For now, I'm just
> > > > > > running a simple java program on one of the RAC nodes that connects to
> > > > > > the database via jdbc thin driver and does a query on schema objects.
> > > > > > Do I specify FastConnectionFailoverEnabled=true in some Oracle
> > > > > > configuration file or in my .java program?
> > > > > >
> > > > > > Thanks.
> > > > >
> > > > > With 10gR2 I would recommend use FCF and not use TAF as TAF seems to be
> > > > > on its way to obsolesence.
> > > > >
> > > > > http://download-west.oracle.com/docs/cd/B19306_01/rac.102/b14197/hafeats.htm#sthref455
> > > > >
> > > > > Should get you where you want to go.
> > > > > --
> > > > > Daniel A. Morgan
> > > > > University of Washington
> > > > > damorgan_at_x.washington.edu
> > > > > (replace x with u to respond)
> > > > > Puget Sound Oracle Users Group
> > > > > www.psoug.org
Received on Sun Aug 27 2006 - 19:56:48 CDT