Re: List of Databases from ESQL/C
Posted in 1994
Topics: Storage & Space Management, Connectivity: ESQL/C, 4GL & Embedded SQL
On Thu, 24 Feb 1994, Neil Larson wrote: > Any one out there know how to get a list of all the databases on the system? > Informix does this when you start isql to build the menu of databases to > select. I have tried to select dbname from the systables, but the field > appears to be empty. Other information, Ver. 4.1, AIX. > > Thanks, Neil Larson Yeah, I asked this question about a week ago, and, among others, Bill Hails responded: "I asked the same question a while back and ado@bigcomm.gun.de (Christoph Adomeit) came back with the answer, which I've modified here: #define MAXDATABASES 256 /* space for pointers */ #define MAXDBSPACE (15 * MAXDATABASES) /* space for strings */ ... char *dbnamespace[MAXDATABASES]; char area[MAXDBSPACE]; int numbases=0; int code=sqgetdbs(&numbases, dbnamespace, MAXDATABASES, area, MAXDBSPACE); if (code==0 && numbases >0) { int i; for (i = 0; i < numbases; ++i) printf("%s\\n", dbnamespace[i]); } Note that you have to decide in advance how many databases you are prepared to hear about (isql sets a limit of 100 which is too small on our site!) Hope this helps. Cheers-- Bill Bill Hails <bill@tardis.co.uk> Tel (UK) 0483 300 200" And it indeed did help! It's really nice to have those guys around... Pawel Pietrusinski Centralny Instytut Ochrony Pracy Warsaw, Poland (cinsop@frodo.nask.org.pl)