Subject: | |
From: | |
Reply To: | |
Date: | Wed, 17 Feb 1999 17:55:41 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi all,
Some time ago I posted a problem with accessing my Allbase DBE
in a server program. The problem turns out to be that my
server middleware closes "stderr" i.e. file descriptor 2.
For some arcane reason, this causes Allbase to give an error,
TurboIMAGE and KSAm connections are no problem. I suspect this
is a MPE quirk introduced in PP3 or PP4, because it was no
problem before that.
For those interested here is a dimbo program to reproduce
the problem. Just build and run under POSIX, using your own DBE.
Regards,
Chris Breemer
/*
Reproduce MPE/Allbase problem.
Once you close stderr, you can;t access your DBE !
Chris Breemer, Compuware Europe B.V., feb 17, 1999
*/
#define DBE "UNIFACE.DATA.UTOOLS"
EXEC SQL INCLUDE SQLCA;
main (int argc, char **argv)
{
EXEC SQL BEGIN DECLARE SECTION;
char dbe[129];
char msg[256];
EXEC SQL END DECLARE SECTION;
/* The "-c" parameter will close stderr and reproduce the problem ! */
if ( argc >1 && !strcmp(argv[1], "-c") )
{
printf("Close stderr...\n");
close(2);
}
strcpy(dbe, DBE);
printf("Connect to '%s' ...\n", dbe);
EXEC SQL CONNECT TO :dbe;
if ( sqlca.sqlcode != 0 )
{
printf("SQLCA.sqlcode = %d\n", sqlca.sqlcode);
EXEC SQL SQLEXPLAIN :msg;
printf("%s\n", msg);
exit(1);
}
printf( "Connect to DBE %s was OK\n", dbe);
EXEC SQL DISCONNECT CURRENT;
exit(0);
}
|
|
|