SE7.2x behaviour over fork and exec
Posted in 1999
Topics: General Discussion
Hi informixer, can anybody give me an exact description of what thinks happens if, by an opened database a fork is done and 2. question: an exec is done? Thanks to all!
Peter wrote: > > Hi informixer, > can anybody give me an exact description of what thinks happens if, by > an opened database a fork is done and 2. question: an exec is done? > Thanks to all! If you fork, exec or not, from a program that has an open database connection then the two processes are sharing the connection. This will NOT work properly! You must, in one of the processes, close the database connection and open a new one. The best way is to call the library function sqlexit() after the fork and before any exec() call, say in the child, and the other process, say the parent, can keep the original connection. If you are not exec()ing the child can then open it's own connection by issuing a CONNECT TO or DATABASE statement. If you are exec()ing another app that makes its own connection then you are all set after the sqlexec() call. Art S. Kagel