Re: Yoo Hoo--are you still there?

From: Tim Smith <tssmith_at_netcom.com>
Date: Thu, 12 Nov 1992 13:11:12 GMT
Message-ID: <1992Nov12.131112.12964_at_netcom.com>


In article <51455_at_seismo.CSS.GOV> jean_at_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_at_netcom.com) Received on Thu Nov 12 1992 - 14:11:12 CET

Original text of this message