Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 8i (8.1.7): How to set timeout when connecting by OCI to remote DB
Yeah, but what about open network sockets, allocated memory space & stuff?
How would I be sure that Oracle will release all of that?
This seems like quite a dirty way to go...
-- -- /Tomislav. "Mladen Gogala" <mgogala_at_earthlink.net> wrote in message news:pan.2002.01.15.21.40.51.614404.10075_at_earthlink.net... On Tue, 15 Jan 2002 10:30:44 -0500, Tomislav wrote:Received on Wed Jan 16 2002 - 04:57:29 CST
> I am wondering how can I set exact timeout how long I want to wait for a
> "OCIServerAttach" or "OCISessionBegin" functions to connect to a remote
> database.
>
> For example:
>
> - network is unplugged or unreachable: functions wait for a couple of
> seconds before reporting an error. I would like to specify exact time to
> wait for this event.
>
> Is the nonblocking mode the only way to go?
>
> --
> --
> /Tomislav.
The only way coming to mind is the posix "alarm" call. To remind you, "alarm" takes the number of seconds as the argument and upon the expiration sends SIGALRM to the invoking application. Application can then decide whether to ignore or act upon the signal (sigaction,signal). I don't know how to facilitate that on an NT machine, but on Unix it's a fairly simple task. More fashionable call with many more options is "setitimer" (set interval timer), which uses the same OS timer resource as the "alarm" call (and thus interferes with it, if both are used) but I strongly prefer the good, old "alarm" call because of it's simplicity. -- Mladen Gogala