This is a multi-part message in MIME format.
--------------11802DA64D7
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 7bit
Mauro G. Pisano wrote:
>
> Informix ON-LINE 5.0:
>
> do anybody know how can I do to know what databases are on-line ?, that is,
> the same that Informix does when it initializes ISQL with no database
> choiced, and then it shows you the list of active databases.
C program from iiug goes as attachment
Michal
--
--------------------------------------------------------------
Michal Hajek mailto:hajek@nspuh.cz
Sprava NIS http://www.nspuh.cz
NsP Uherske Hradiste phone : voice +420 0632 529 204
Purkynova 365 fax +420 0632 551 014
686 68 Uherske Hradiste Czech Republic
--------------------------------------------------------------
--------------11802DA64D7
Content-Type: text/plain; charset=iso-8859-2; name="dbnames.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dbnames.c"
/*
@(#)File: dbnames.c
@(#)Version: 1.10
@(#)Last changed: 97/05/19
@(#)Purpose: Print list of visible databases
@(#)Author: John Cooke/Mark Jeske/Jonathan Leffler
@(#)For HP_UX: Michal Hajek hajek@nspuh.cz
*/
/*
***********************************************************
** This code is derived from two almost identical **
** programs with the identifications preserved below: **
***********************************************************
** dbnames.ec **
** List all available database names. **
** Mark J (Informix) 3-13-91 **
***********************************************************
** From: johnc@obelix (John Cooke) **
** Quite a coincidence .... I wrote THIS program: **
** program to get the names of all visible databases **
***********************************************************
** Compile using: **
** cc -o dbnames dbnames.c $INFORMIXDIR/lib/libfesql.a \\ **
** $INFORMIXDIR/lib/libfe.a **
***********************************************************
*/
#ifndef lint
static char sccs[] = "@(#)dbnames.ec 1.10 97/05/19";
#endif
#include <stdio.h>
#define MAXDBS 100
#define FASIZ (MAXDBS * 19)
main()
{
int ndbs;
int sqlcode;
int i;
char *dbsname[MAXDBS + 1];
char dbsarea[FASIZ];
if ((sqlcode = sqgetdbs(&ndbs, dbsname, MAXDBS, dbsarea, FASIZ)) != 0)
fprintf(stderr, "error code %d from sqgetdbs\\n", sqlcode);
else
{
for (i = 0; i < ndbs; ++i)
printf("%s\\n",dbsname[i]);
}
return (0);
}
--------------11802DA64D7--