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 -> Re: OCI cursors and fork().

Re: OCI cursors and fork().

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 19 Nov 1998 18:57:58 GMT
Message-ID: <366069bc.107384080@192.86.155.100>


A copy of this was sent to geraintwilliams_at_my-dejanews.com (if that email address didn't require changing) On Thu, 19 Nov 1998 14:12:35 GMT, you wrote:

>Can you help?
>
>I am trying to write a small server program (c with OCI calls),
>which logs into the database and forks a process to execute a piece of SQL
>for each request it receives.
>
>However, I am unable to open and use cursors from separate processes
>concurrently. Is there a way around this, or will I have to open a
>new connection to Oracle each time I fork?
>
>I am using oracle 7.3.4
>

if you connect in the parent and attempt to use that connection in the child, it will not work correctly (if a parent spawns 2 child processes for example, they are both talking to the same oracle dedicated server -- it will crash in a spectactular fashion. Also due to fact that child processes inherit the parents file descriptors and all, the parent will read data meant for the child and vice versa).

If you fork, logoff before doing so.
If the child needs a database connection, do so AFTER forking.

> Many thanks to anyone who can help me.
>
> Geraint
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Nov 19 1998 - 12:57:58 CST

Original text of this message

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