Re: How to find Online-Database-Names
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion
Martin Hiller wrote:
> Hi,
> in which database:table are the Names of my
> Online-Databases stored?
> I use them because i want to run 'dbexport'
> every morning on all databases.
> (Yet i'am extracting the Names in a Shell-Script
> using 'tbcheck -pe'.)
> Thanks for suggestions.
If I can infer from the fact that you are using tbcheck that you are on
OnLine 4.x or 5.x, then your database names are not stored in any database
table. However, there is an undocumented function call you can make from
ESQL/C (and 4GL as well, I think). I don't remember what it's called, but
Informix Tech Support can give it to you (it's in their TechInfo system).
It may also be floating around the IIUG software archives as well.
June
--
june_t@hotmail.com
Grounded in Palo Alto, living on brownies and chocolate chip cookies
Please do not send Informix questions to this account.
I would add 'Please do not send spam to this account'
but I suppose I would be wasting my bits.
June Tong wrote:
>
> Martin Hiller wrote:
>
> > Hi,
> > in which database:table are the Names of my
> > Online-Databases stored?
> > I use them because i want to run 'dbexport'
> > every morning on all databases.
> > (Yet i'am extracting the Names in a Shell-Script
> > using 'tbcheck -pe'.)
> > Thanks for suggestions.
>
> If I can infer from the fact that you are using tbcheck that you are on
> OnLine 4.x or 5.x, then your database names are not stored in any database
> table. However, there is an undocumented function call you can make from
> ESQL/C (and 4GL as well, I think). I don't remember what it's called, but
> Informix Tech Support can give it to you (it's in their TechInfo system).
> It may also be floating around the IIUG software archives as well.
The function is:
sqgetdbs( int *db_count, /* Addr of int to contain # databases */
char **dbnames, /* Addr of array of char * to hold names */
int db_max, /* # of char * pointers dbnames can hold */
char *namearea, /* Addr of memory for name strings */
int area_size ); /* Size in bytes of namearea */
Ex:
#define DB_MAX 40
#define DB_LEN 31
int db_count, i;
char *namearea, **dbnames;
namearea = (char *)malloc( DB_MAX * DB_LEN );
dbnames = (char **)malloc( DB_MAX * sizeof (char *) );
sqlstart();
sqgetdbs( &db_count, dbnames, DB_MAX, namearea, (DB_MAX * DB_LEN) );
for (i=0; i<db_count, i++)
printf( "Database: %s.\\n", dbnames[i] );
This function is for 5.xx ONLY it does exist in 7.xx but as an
undocumented function it is not supported. Query sysdatabases instead.
Art S. Kagel