Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Checking Connection Status in a Pro*C program
I've got a similar application, which happens to be a DCE based server, utilizing the
Informix database. On an incoming RPC call, I have a function I call to ensure the
connection is still valid. This function runs a simple, inexpensive query (for
oracle you could SELECT 1 INTO :x FROM dual) and checks the SQLCA for errors. If
there is an error, I reestablish a new connection, perform any startup chores, etc.
You shouldn't get a SEGV from this kind of process, unless something is wrong in your
code. If you are really hard up you could try setting up signal handling and
setjmp/longjmp to catch the SEGV but this can be hazardous, as the internal library
state might be hosed.
Peter
MEYOU_at_ComPorts.com wrote:
> On 13 Apr 1998 17:19:02 GMT, jstrange_at_imtn.dsccc.com (John Strange)
> wrote:
>
> >some code snippets:
> >
> >
> >EXEC SQL INCLUDE SQLCA ;
> >
> > EXEC SQL CONNECT :appidpwd ;
> >
> > errno = 0 ; /* clear errno in case oracle sets it */
> >
> > if (sqlca.sqlcode != 0) /* check oracle error */
> > {
> > your error code here
> > }
> >
> >
>
> Thanks for your reply but what I want to know is how to check for
> connection status long after the above call is made.
>
> My server daemon listens for clients' call and insert appropriate
> stuff from the clients into a remote oracle database. The daemon only
> logs in once into the remote database. I will get CORE DUMPED when
> the daemon performs the insert action if the existing connection is
> not valid (ie the remote database is down) . If I know the connection
> status, I can perform other necessary action to safeguard smooth
> operation (to use a secondary remote database). This daemon can not
> down and must perform smoothly.
>
> Please help.....
>
> Regards
>
> Steven.
>
> >MEYOU_at_ComPorts.com wrote:
> >: Is there anyway to check connection status after "CONNECT" call in a
> >: Pro*C program?
> >
> >: Need to know how very urgently. Please help!
> >
> >: Regards
> >
> >: Steven
> >
> >--
> >While DSC may claim ownership of all my ideas (on or off the job),
> >DSC does not claim any responsibility for them. Warranty expired when you
> >opened this article and I will not be responsible for its contents or use.
Received on Thu Apr 16 1998 - 06:51:05 CDT
![]() |
![]() |