On Thu, 13 Nov 1997, Phuoc Ho wrote:
> How can we disconnect from the database and see no connection
> in onstat -u. We have tried various "close database", "disconnect"
> but no thing seems to work. Did anyone try this?
>
> We basically need to run a 4gl program that will only connect
> to the database on command.
>
> We are using: ONLINE 7.23 and Informix 4gl v 6.01
You'd have to call an ESQL/C function which implements DISCONNECT DEFAULT
or DISCONNECT CURRENT (either will work).
When I4GL opens a database, it does so on the default connection (because
anybody who does 'DATABASE xyz' without having a current connection is
connected using the default connection). There is, or should be, code in
the IIUG archive (http://www.iiug.org) to handle CONNECT, SET CONNECTION
and DISCONNECT from I4GL, which would save you having to write your own,
though it isn't exactly difficult:
int disconnect_dbs(int nargs)
{
if (nargs != 0)
fgl_fatal("disconnect_dbs", 0, -1318);
EXEC SQL DISCONNECT DEFAULT;
return 0;
}
In the I4GL code, you'd write:
CALL disconnect_dbs()
Yours,
Jonathan Leffler (johnl@informix.com) #include <witticism.h>