Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL to List All Database Names

Status
Not open for further replies.

manishg2000

Programmer
Apr 4, 2011
2
US
What sql query can I use to list names of all databases in DB2 (need to call it via jdbc)?

Something of the flavor like in Mysql we have [Show Databases]

And "LIST DATABASE DIRECTORY" is not much help when making a jdbc call.

Thanks!
 
btw also

SELECT * FROM SYSIBM.SYSDATABASE gives an error for me

SQL0204N "SYSIBM.SYSDATABASE" is an undefined name. SQLSTATE=42704

So not able to use that even.:(
 
JDBC/ODBC connectors are not designed for that. You use it to connect to a specific database and that database is the scope. You could try to use the "SYSPROC.ADMIN_CMD" for the LIST DB DIRECTORY.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top