Re: Closing OnLine session
Posted in 1997
Rudy Fernandes (rferdy@kuwait.net) wrote:
>X-Informix-List-Id: <news.37322>
>
>Maestro@post1.com (Maestro) wrote:
>>I'm attempting to reduce the number of OnLine sessions in a 100-user
>>database application, would like to hear from you on one area which I'm not
>>able to figure out.
>>
>>I have a 4GL program(A) which serves as a main menu. This program(A)
>>has a db connection for performing simple read and will run other database
>>programs as required by users. In an attempt to reduce the concurrent
>>sessions, I tried issuing a CLOSE DATABASE statement in program(A) but this
>>particular session still appear in onstat -g ses output. ??
>>
>>Anyone has any idea why is that so? Is there any other way to close the
>>session?
>>
>It appears that only a DISCONNECT will free a session (Try it out in
>dbaccess). Unfortunately DISCONNECT returns a syntax error in 4GL
>(because its v6, I suppose). Further, DISCONNECT cannot be PREPAREd, unlike
>statements like SET OPTIMIZATION which are not recognized by 4GL but
>can be PREPAREd and EXECUTEd.
Several pieces of information:
(1) Version 6.0x I4GL understands precisely the same SQL syntax as 4.1x
I4GL, the 4.10 engine syntax. CONNECT is too recent (6.00 upwards) to
be part of the SQL it understands, despite what the version numbers
suggest.
(2) I posted some ESQL/C code to allow I4GL program to use CONNECT and
friends via a set of function calls. Check in the IIUG archives
(http://www.iiug.org) for the source code.
(3) There is another function, sqlexit(), which can be used to terminate
database connections. It is, however, an ESQL/C function, not an I4GL
function. You'd have to have some C code in your I4GL to use it:
/* uncompiled, but should be OK! */
#include "fglsys.h" /* declares fgl_fatal() */
int i4gl_sqlexit(int n)
{
if (n != 0)
fgl_fatal("i4gl_sqlexit", 1, -1318);
sqlexit();
return(0);
}
(4) DISCONNECT only works with 6.00 and later servers, whereas sqlexit()
works with earlier versions too.
>It does look like it works under ESQL (Why this discrimination?), so
>maybe your menu program has to be written in C.
>
>Let me know if you find a 4GL solution to this problem which I face
>as well.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>