Re: OCI and MultiThreading
Date: 1996/11/23
Message-ID: <32977d1c.834900_at_dcsun4>#1/1
On 12 Nov 1996 21:57:58 GMT, "Mogens Olesen" <Mogens_Olesen_at_net.dialog.dk> wrote:
>I'm currently developing a system using OCI in a multithreaded environment.
>I do have lots of trouble with accessviolations when calling the OCI
>functions.
>Especially when calling oopen from different threads, using a threadlocal
>CDA and
>a common LDA (session/connection) for all calls to oopen.
>
>As soon as I serialize a transaction within critical section, meaning that
>no cursor can
>execute simultanously on the same LDA the problems seem to disappear.
>
>Also if I make one connection for every cursor, the problems disappear.
>
>Have anyone experienced similar problems or maybe know about
>OCI-restrictions in
>this matter ?
>
The docs for 7.3 are pretty clear-- one connect per process implies you must use a mutex to allow only one thread to access a connection (LDA) at a time. One connect per thread allows you to remove the mutexes and run many queries concurrently.
Pre 7.3, OCI was not thread safe so you would have to use mutexes regardless of how many connections you had....
See chapt 2, 'Thread Safety' section of the OCI programmers guide with the 7.3 doc set for more info.
>Thanks in advance
>Mogens
>
Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com
- Check out Oracle Governments web site! -----
Follow the link to "Tech Center"
and then downloadable Utilities for some free software...
statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Sat Nov 23 1996 - 00:00:00 CET