Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI cursors and fork().
You should be able to (connect in the parent and use the same connection
for each child ). It is in the manual. The major issue is that everyone is
sharing the same data area. You need to get exclusive rights to the
connection, perform the task, then release the exclusive rights.
This is done via semophores or the like.
You also need to open the database properly -- I forget the exact login command. One allow one and only one connection. One allow many other connections to open at the same time. Again in the OCI manuals.
There is also a multi-thread notification function that should be called once. Again, I cannot recall the name, but it allows for multithreaded calling. The default (if it is omited) is a single threaded environment for Oracle. Again, in the OCI manuals.
Mike Krolewski
geraintwilliams_at_my-dejanews.com 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
>
> 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
Received on Sat Nov 28 1998 - 20:32:04 CST