Results 1 to 2 of 2

Thread: OCI and threads

  1. #1
    Join Date
    Oct 2003

    Unanswered: OCI and threads

    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.

  2. #2
    Join Date
    Oct 2003
    Any info then on perhaps some good OCI documentation other than the Oracle documentation? Book recommendations, anything. I've scoured the web but have come up with little that is useful, particularly book-wise as OCI does not seem to be included in most books.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts