Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help! Multithreaded app needs to access Oracle
Matthew K. Smith wrote:
>
> I'm having a problem accessing our Oracle 7 database from two different
> threads within a C++ application. What happens is that each thread tries
> to
> access the database at the same time and the app crashes, giving me the
> following message:
>
> ORA-03106: fatal two-task communication protocol error
>
> To my knowledge, Oracle will not allow a single process to have multiple
> connections to it, so I know that is not the solution.
>
> It was also suggested that I use PL/SQL scripts that reside on the database
> instead of embedded SQL in my app. Unfortunately that will not work either
> because the tables being accessed by my app are constantly changing, and
> PL/SQL scripts would have to be re-written all the time.
>
> For the time being, I have defined a mutex lock that will not allow the two
> threads to access the database at the same time, but this does not allow
> the app to achieve the speed that we need. If any of you have encountered
> similar problems, or know of a solution, I would appreciate your
> suggestions.
Oracle libraries are not thread-safe prior to 7.3; we have yet to install 7.3 here so I haven't yet verified the rumour that 7.3 is thread-safe. In my client-server app in a 7.2 installation, we have multiple single-threaded server processes each with their own connection to Oracle. My multithreaded client can then issue many RPCs simultaneously, each of which is distributed to a separate server process.
If you're already on 7.3, I'm not sure I can be too much help, but check your TWO_TASK environment variable. If the program you're executing is on the same machine as the database itself, use the pipe driver "P:", not the TCP driver "T:". Besides the pipe driver being faster, we had some strange problems (I can't recall specifically, it's been too long) with the TCP driver when we first set up our servers.
If you're pre-7.3 and are in a client-server environment, I'd recommend the client-server approach above to solve your problem; it works quite well here - from the client's perspective, we have multithreaded access to Oracle.
If you don't have a client-server framework to build from, I think you're stuck with the mutex until you get 7.3.
Let me know if this helps, especially if you're on 7.3 - we plan on converting 2Q97 and I'm anxious to hear how thread-safe 7.3 really is.
-- John Verbil U S WEST Communications Information Technologies jverbil_at_uswest.com (303) 896-0916Received on Fri Dec 20 1996 - 00:00:00 CST
![]() |
![]() |