Pro*C and Solaris 2.4 threads

From: <pwoodard_at_on.bell.ca>
Date: 1995/08/09
Message-ID: <NEWTNews.807987968.32655.peter_at_ba8c7e.on.bell.ca>#1/1


I have a Pro*C program on Solaris 2.4 which uses threads (thr_XXXX) to execute common embedded SQL code simultaneously (multi-processor). For example, I've written code which opens a cursor, fetches records from a table, and closes the cursor. I've run this code using threads as follows:

Scenario #1:
I tried having the process do an EXEC SQL CONNECT ..... to the database only once when it starts up. Then each spawned thread will already be connected. But when 2 or more threads simultaneously execute the above cursor example I get the following error messages at random:

SQL-02103: PCC: inconsistent cursor cache (out-of-range cuc ref)
ORA-03106: fatal two-task communication protocol error
ORA-01002: fetch out of sequence

Scenario #2:
I also tried having each thread to its own EXEC SQL CONNECT ... when it gets spawned and then disconnect when finished. But when 2 or more threads execute the code simultaneously, I get the following errors at random:

ORA-12547: TNS: lost contact
ORA-12637: TNS: packet receive failed
ORA-12203: TNS: unable to connect to destination
I have verified that only the first thread was able to connect to the database!

On page 6-31 of the "Programmer's Guide to Pro*C 2.0" it states that Pro*C generates reentrant code. It seems to me that it doesn't because I am having concurrency problems. The manual also states (pg. 3-77) that a process can connect to the same database multiple times. Well this doesn't work for me either!

Looking at the code generated by Pro*C, I see some global static declarations. If these static variables get modified during program execution, then obviously Pro*C does not generate reentrant code.

Can someone verify whether Pro*C generates TRUE reentrant code? Am I doing something wrong in my code or am I missing anything? Do I need to configure the Oracle engine to support multi-threaded Pro*C programs?
I am using Oracle 7.1.6.

Any help would be appreciated,

Peter
pwoodard_at_on.bell.ca Received on Wed Aug 09 1995 - 00:00:00 CEST

Original text of this message