开发者

Oracle beq and popen()

开发者 https://www.devze.com 2023-03-31 06:13 出处:网络
I have a program like this (that\'s for Pro*C precompiler): #include <stdio.h> #include <stdlib.h>

I have a program like this (that's for Pro*C precompiler):

#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <errno.h>

EXEC SQL BEGIN DECLARE SECTION;
static VARCHAR ora_connect_str[81];
EXEC SQL END DECLARE SECTION;

EXEC SQL INCLUDE SQLCA;

int main()
{
   FILE *f;
   int rc = 1;
   char *eptr=getenv("DB_LOGIN");

   strcpy(ora_connect_str.arr, eptr);
   ora_connect_str.len = strlen(eptr);

   EXEC SQL CONNECT :ora_connect_str;

   f=popen("exit 0", "r");
   rc = pclose(f);
   printf("errno=%d rc=%d\n", errno, rc);
}

When I use a tcp/ip connection to oracle, it works ok. But when I use BEQ, pclose() returns -开发者_如何学编程1 with errno 10. Can someone direct me to a document(s) describing the possible issues with BEQ connections? It appears that somewhere in the oracle's entrails there is wait() call already…


Take a look at this post: http://openacs.org/forums/message-view?message_id=187522

The important section is:

  /* Restore SIGCHLD since Oracle10 client has trapped it **SG** */
  signal(SIGCHLD, SIG_DFL);

Try adding it before your 'popen' call, it should work.

You will have to deal with whatever Oracle is trying to ignore though, or have zombie processes hanging.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号