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 -> Re: Multiple child process and two-task error

Re: Multiple child process and two-task error

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 30 Dec 1999 08:01:01 -0500
Message-ID: <0olm6ssnil3vq8826b8e2t9a4qm78gm3gb@4ax.com>


A copy of this was sent to "Totoro" <chongyp_at_mailhost.net> (if that email address didn't require changing) On Thu, 30 Dec 1999 20:01:31 +0800, you wrote:

>I am writing a ProC program that require multiple child process to query the
>database with only one connection.
>

bad idea, not supported, will break in strange and mysterious ways at various points in time.

a connection can only be used by one process. If you have a parent that forks a child and lets the child inherit file descriptors and all -- it is standard procedure to disconnect before forking. The child *cannot* share that connection safely. It needs its own connection.

>Initially I restriced that only one child can query one table at a time,
>however, I encounter a "Two-task communication protocol error"
>
>I managed to "avoid" the error by allowing only one child to query the
>database at a time.
>
>May I know the reason or cause for the above mentioned "two-task error"?
>
>If I really need to have multiple child process query the database at a time
>with only one connection, is there any way that I can work around it to
>avoid the error?
>

use threads in a single application and use the Mutli-threaded api's for pro*c (threads=yes and use a sql_context).

a child process cannot safely share a connection with other children. it is not designed to work that way.

>Thanks in advance!
>

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Dec 30 1999 - 07:01:01 CST

Original text of this message

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