Multithreading Oracle OCI 7.3

From: <pip_at_dbmx.com>
Date: 1996/12/18
Message-ID: <850892680.22072_at_dejanews.com>#1/1


Hi All,

in <846686961.26920_at_dejanews.com> I said:-

> SNIP..
> It seems that the 'thread safe' 7.3 OCI libraries are not
> thread safe at all. In fact any attempt to use OCI within
> a thread (even with mutex locks around the calls) results
> in a core dump. Its all OK if the calls are made in a non-threaded
> program. This is consistent on Sunos and Solaris (Our main
> development platforms).
> SNIP...
I got a number of replies to this, most of which were not posted to the newsgroup, so thank you to all newsgroup visible and invisible people that helped me.

I have found 4 solutions to this problem. Generally it depends on which threads package you are using, and I would ALWAYS do solution 1 regardless - better to be safe than sorry! Here they are:-

  1. Call opinit() before any other package initialisation, particularly before thread package initialisation (if possible).
  2. Oracle OCI 7.3 seems to have problems with some non standard thread package mutex locks on some platforms, so remove the mutex locks around the OCI code (which, with the correct opinit() call is now thread safe).
  3. As Alain Chereau rightly points out, don't use threads unless you have to.

and  

  4. If you have to use threads, use the 7.2 version of OCI. This will

     still work against Oracle 7.3 on most platforms - you'll have to
     try it to find out.

I have closed the bug at Oracle because I concluded that it was not simply an Oracle bug but the interaction of Oracle and other (threads) packages, which work fine in isolation.

I should have posted this a while ago but it slipped down my list of priorities, my apologies to anyone out there who thought that this was an outstanding problem.

Once again, thanks for your responses.

Regards

Pip

+----------------------------+------------------------------+
| Phil (Pip) Meadway         | Mail : pip_at_dbmx.com          |
| Principal Architect        | Web  : http://www.dbmx.com   |
| Product Engineering Group  | Tel  : (00 44) 171 353 4212  |
| DBMX Ltd.                  | Fax  : (00 44) 171 936 3582  |
+----------------------------+------------------------------+

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Wed Dec 18 1996 - 00:00:00 CET

Original text of this message