Re: ? about ODatabase and threads

From: Mike Krolewski <mkrolewski_at_rii.com>
Date: Thu, 11 Jan 2001 21:50:52 GMT
Message-ID: <93l9ro$sui$1_at_nnrp1.deja.com>


In article <93l570$o4m$1_at_nnrp1.deja.com>,   fuckingstupid_at_my-deja.com wrote:
> Basically I have a few threads who all create ODatabase objects and
 try
> to get some info from it. My process will crash if two of the threads
> try to access the oracle objects at the same time and it crashes in
 the
> OIP23.DLL which I found in my oracle folder.
>
> Since I cannot find my oracls pdf's to look to see if it says anything
> regarding thread safetyness I decided to ask here.
>
> Thanks for any info
>
> Sent via Deja.com
> http://www.deja.com/
>

It appears that most of the documentation resides in the installation disks for the product. There are no authorized manuals. (according to the precompiler manuals).

It also appears that OO40 can be made thread safe. (see below)

However, if you are using the same connection for all the threads, standard thread safe practices apply. You need to review the concepts of multi-threading. Any reading or writing to the database should be one thread at a time. A mutex or similar object should be used to block the other threads. Else you will get errors.

To make each thread independent, you need to make separate connections for each thread. Typically, the openning of the connection happens after the startup of the thread in the thread process. A good place would be the function/procedure/subroutine where the thread is initialized and configured. Similarly, connection should be shut down as the thread is closed.

How you access different connections within OO40 is unknown to me.

( notes from found by http://www.oracle.com/products/ and hitting search icon, then searching on OLE. Note: i have a free technet account..

Oracle Objects for OLE (OO4O) Release Notes

This product is updated frequently. You can make sure you have the latest version of oo4o by checking the following sites: ftp://externalftp. us.oracle.com/dev_tools/patchsets/mslang/oo4o/or http://technet.oracle.com/tech/nt/ole/

Release 8.1.6.3.8

June 2000
)
...

OStartup with ApartmentThreaded (default) option

When calling OStartup from C++ Class library without the OSTARTUP_MULTITHREADED option, connections with same username, password, and connect alias are shared. This is to insure backward compatibility with version 2.3 and before.

Error: CoInitializeEx() not found in OLE32.DLL

You will receive an error similar to this one if you use the Class Libraries with an older version of Win95, and you call OStartup() with the MultiThreading option. To correct this you need to obtain NT 4.0, or the DCOM patch for Windows 95.

--
Michael Krolewski
Rosetta Inpharmatics
mkrolewski_at_rii.com
              Usual disclaimers


Sent via Deja.com
http://www.deja.com/
Received on Thu Jan 11 2001 - 22:50:52 CET

Original text of this message