Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> OCI and pthreads

OCI and pthreads

From: wade_harris <member43240_at_dbforums.com>
Date: Wed, 08 Oct 2003 11:40:09 -0400
Message-ID: <3407172.1065627609@dbforums.com>

I'm using OCI in a multi-threaded C application which uses pthreads for the threading, this is on Solaris 8 with Oracle9i (9.0.1 to be exact).

After reading the OCI documentation, I'm confused on whether or not I have to use the OCIThread API's to handle thread creation and management or whether or not is safe to use pthreads. All of the Oracle examples I've found use the OCIThread library, but the documentation does not state clearly whether this is necessary or not, it even seems to hint at the fact that you can use whatever thread implementation you want.

The documentation states that you can initialize the OCI environment with OCI_THREADED and this will handle mutexing and so forth. This application is fairly large and is already working, I don't care to have to re-write how the threads are managed if at all possible. This Oracle query is something that I'm having to throw in at the last minute, so it was not planned for initially.

Does anyone know if it is safe to use pthreads and OCI in this fashion? And if so, will OCI actually handle the mutexing as the documentation states or does that require also setting up the threads via the OCIThread API's?

The query the threads need to do is a simple SELECT and it is also only in rare situations, they're not constantly spamming the database. I would use embedded SQL although I'm not sure if that is thread-safe but speed is also paramount, so that is why I'm going with OCI. (It's asynchronous calls are also helpful as I cannot afford to have blocking when making the queries.)

Best regards.

--
Posted via http://dbforums.com
Received on Wed Oct 08 2003 - 10:40:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US