Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to use OCI/ODBC in multi-process programs?
Jason Liang wrote:
> I can't use thread, because I have to use another library that is not
> thread-safe.
>
> I know if I open a file before forking a process, then the child
> process will inherate the open file descriptor. I am not sure if a
> child process inherate an open database connection - using OCI or
> ODBC.
>
Right now there is no way through OCI to share a connection among
processes. Fork replicates file descriptors and also the OCI handles,
but you can get undefined results if you try to use the replicated OCI
handles in both the parent and child(you should be able to use just one
of them though!).
Connection pool would be a good entry point to implementing the required
feature. However, currently, the connection pool is single-process. If
Oracle makes it shareable across processes, not necessarily just
parent-child, that'l be a solution to you among others. You can try to
file a request for this feature with Oracle!
Thanks,
Sree
Received on Mon Sep 20 2004 - 04:06:59 CDT
![]() |
![]() |