Re: esql/c v5, sqlexec problem
Posted in 1995
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
In article <43ncbo$flp@cssun.mathcs.emory.edu>, CRAIG@CHEMISTRY.CHEM.UTAH.EDU wrote: > In what order does your program work? My parent program connects and then forks AND execs. It *has* to work this way. > to me since, after you forked, you would essentially have two processes > sharing a single connection to the database. A confusing situation > indeed! Try forking the child first and then have each connect to > the database. This is why they suggested I try sqldetach() I think. In the Informix-ESQL/C manual it states that sqldetach is not for use if the forked process executes an exec, which my program does. Using sqldetach() in the child however, makes the parent process id the id of my process instead of the sqlexec process. This concerns me because I thought the ppid was fixed at the fork and I don't know how Informix could changed the parent process id of a process AFTER it's been forked & exec'ed. Maybe there's just a system call I'm missing. Spurred by your comments I did two things: Forked the child, then connected to the database. The parent's sqlexec did not hang. Unfortunately this is not an option. My parent process is a GUI that controls execution of the child processes and must always be connected. Then I tried connecting to the database, forking the child and having the child try to do a database access without explicitly connecting to the database.. It didn't work, so I doubt your statement that both process are sharing a single connection to the database. Basically, I don't see why *any* process that is a child should know anything about it's siblings, much less block waiting for their exit, which is what Informix's sqlexec process is doing. I guess I will go read Stevens and try to figure out what could be going on in terms of dup'ing pipes and such. (Eureka! An *idea*!) Maybe I just need to close all file descriptors in the child process... Thanks for your input. Any other ideas? fleur -- Fleur Diana Dragan / fleur@clark.net -- It's my name. Really, it is. Belly dancers make favorite wives.