Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Handling OCI errors

Handling OCI errors

From: Sundar Raman <cybertoast_at_mindless.com>
Date: Fri, 27 Aug 1999 11:13:17 -0500
Message-ID: <37C6B91D.895F4D6@mindless.com>


OS: Solaris
OraVer: 8.0.5
Tool: OCI calls for Ora 7.3

I'm a newbie to the whole OCI thing, and am running into problems with my understanding of OCIs mechanism. The application that I've got is multithreaded. I'm trying to figure out how to ensure that my app recovers gracefully from a database error. If the DB connection goes down (usually for network reasons or Oracle maintenance shutdown), I'd like my application to retry the connection (with pauses) until it succeeds, or a timeout is hit.

I'm using a single connection to Oracle, with all threads sending their requests through this one path,
So here are my questions:
1. When an OCI call bombs, how does one know that it's as a result of losing the DB connection as opposed to some other problem (and does it matter).
2. If the OCI error is due to db connection problems, what steps do i need to take to attempt a reconnection? The sequence as i understand it is -

     olog, oopen, [process - oparse, obndrn, oexec, etc], !--
     problem --!, oclose (but will this call also fail?), ologof.

So when a connection failure occurs, am I supposed to perform the entire sequence (olog -> ologof) again, or is there some way to just re-establish the connection since the I'm already logged on to Oracle? 3. Is there any way to have all the threads be aware that the dbconnection is down - is there a handle that is provided by OCI's olog or oopen that can be checked for validity? This question comes up so that every thread that detects an error does not attempt to re-establish the connection if another thread is already doing so.

Thanks a lot for any help. Received on Fri Aug 27 1999 - 11:13:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US