How to open a 2nd DB without closing the 1st in ESQL/C?
Posted in 1995
Informix Gurus, How can one open a second DB without closing the first? Our application is written in ESQL/C, keeping our database open with several resources allocated (Statements defined, cursors declared etc). Now I need to open the sysmaster db briefly, query it and close it, but I do not want to close our main database (thus freeing up the resources). The way I do it is if ((cpid = fork()) == -1) perror("fork"); if (cpid == 0) { /* Child process */ Open_Sysmaster_DB(); /* thereby closing our main db */ Query_Sysmaster_DB(); Close_Sysmaster_DB(); exit(0); } else wait(cpid); The child works fine and exits, and the parent continues. But now when the parent tries to access a preallocated resource (fetch from an open cursor), it just hangs there and never returns. Have those resources been freed when the chile opened sysmaster (thereby closing our main db)? The child should inherit the parent's environment, and therefore close the main DB in its own process space. The main DB in the parent's process space should still be open. What am I doing wring here? Any and all responses appreciated. I am running Online 7.1, ESQL/C 6.00.UE1 on an IBM RS6000 AIX 4.1.1. Thanx, Raj.