home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.oracle
- Path: sparky!uunet!think.com!spool.mu.edu!umn.edu!csus.edu!netcom.com!tssmith
- From: tssmith@netcom.com (Tim Smith)
- Subject: Re: Yoo Hoo--are you still there?
- Message-ID: <1992Nov12.131112.12964@netcom.com>
- Keywords: ping
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- References: <51455@seismo.CSS.GOV>
- Date: Thu, 12 Nov 1992 13:11:12 GMT
- Lines: 38
-
- In article <51455@seismo.CSS.GOV> jean@seismo.CSS.GOV (Jean Anderson) writes:
- >What's the cheapest way to tell from OCI if a frontend database connection
- >is still alive? I want to do something like this:
- >
- > if(db_dead()==TRUE)
- > {
- > -- do something reasonable, maybe re-establish connection
- > }
- >
- >I'm looking for a cheap ping for db_dead(), maybe a "select 'x' from dual",
- >although I'd like to avoid a select.
- >
- >Is there a better way to check, maybe already a hook I don't know about?
- >
- >thanks,
- >
- > -jean
-
- Why not just try to oopen a new cursor using that LDA? Something like
-
- if (!oopen(&dummy_cursor, &dubious_lda, ...))
- {
- printf("I'm still here!\n");
- oclose(&dummy_cursor);
- }
- else /* you'll get ORA-01012 if it's dead */
- {
- /* do what's needed to re-establish the connection */
- }
-
- Or, you could try a parse of "select 'x' from dual" using a cursor
- open on that connection, if you have a cursor to spare. Make sure you
- oparse in non-deferred mode.
-
- --Tim (tssmith@netcom.com)
-
-
-
-