Pro*C and fork()

From: Peter Koch <koch_at_math.uni-duisburg.de>
Date: 17 Aug 1998 07:11:53 GMT
Message-ID: <6r8l3p$mnj$1_at_news-hrz.uni-duisburg.de>



Dear readers:

I'm writing a C-program that connects to a database, then forks a couple of childs which are supposed to open a seperate connection.

main()
{
  ...
  EXEC SQL CONNECT ... /* Open connection 1 */

  Here I want to use connection 1 - no problem

  if(fork()){
/* This is the parent process */

    Here I want to use connection 1 - no problem

  } else {
/* This is the child process */

    Can I use connection 1 here without interfering with     the parent - process

    EXEC SQL CONNECT ... /* Open connection 2 */

    Here I want to use connection 2
  }

[Quoted] Now the problem is, that opening a second connection in the child - process seems to nterfere with connection of the parent - process.

I'm not familiar with the internals of SqlNet, but my guess is that opening a connection will open a socket on port 1521, fork() will duplicate the corresponding files-descriptor, but Oracle seems to get confused if two processes send data on this socket at the same time.

Is this correct?

How do I open a seperate connection in the child process WITHOUT closing the original on in the parent-process?

Thanks!

Peter

--
Peter Koch <Koch_at_Math.Uni-Duisburg.DE>      phone: 49 203 379-2698
Department of Mathematics                     fax: 49 203 379-3139
University of Duisburg, Lotharstrasse 65, 47048 Duisburg - Germany
Received on Mon Aug 17 1998 - 09:11:53 CEST

Original text of this message