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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list the name of all databases

Status
Not open for further replies.

mauroverardi

Programmer
May 30, 2005
5
IT
hi
I have to write a program in JDBC that can retrieve the name of the databases on a db2 server, the only way I know is the command "list database directory", but it can not be used in JDBC can someone help me? Thanks
 
unfortunately no...I have to list all the databases on a DB2 server istance, is there a database or a table or a file or something else listing the name of the databases? For example in Microsoft SQLServer there is an entire database with this information, maybe there is no solution because this is a protected information, like in Oracle. Do you know a way to execute the command "list database directory" in a JAVA program? This may be a solution. Thank
 
I have no experience with JDBC and therefore can not tell you how to make use of this information, but on the mainframe, the SYSDATABASE table contains all the databases within a particular DB2 system. For instance, I might use
Code:
SELECT * FROM SYSIBM.SYSDATABASE
to see what what was out there. The columns available on that table are:
Code:
COLUMN NAME        TYPE(LEN)
------------------ ---------
NAME               CHAR(8)  
CREATOR            CHAR(8)  
STGROUP            CHAR(8)  
BPOOL              CHAR(8)  
DBID               SMALLINT 
IBMREQD            CHAR(1)  
CREATEDBY          CHAR(8)  
ROSHARE            CHAR(1)  
TIMESTAMP          TIMESTMP 
TYPE               CHAR(1)  
GROUP_MEMBER       CHAR(8)  
CREATEDTS          TIMESTMP 
ALTEREDTS          TIMESTMP 
ENCODING_SCHEME    CHAR(1)  
SBCS_CCSID         INTEGER  
DBCS_CCSID         INTEGER  
MIXED_CCSID        INTEGER  
INDEXBP            CHAR(8)
Does that help any?

Ever onward,
jar
 
this solution may be perfect because with JDBC you are able to submit queryes and retrieve the result table, but I do not find the table SYSIBM.SYSDATABASE on my system ( DB2 Universal Database Express Edition ), maybe the mine is a limited version? This table should be into each database?
 
I do not have any experience with DB2 Universal Database Express Edition. However, I have to believe the the system tables are there somewhere. I make tremendous use of SYSTABLES, SYSTABLESPACE, SYSPLANS, and the like. I had never used SYSDATABASE until you posed your question but found it with no trouble. Perhaps the 'creator' is not SYSIBM on your system.

Sorry I could not be of more help.

Ever onward,
jar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top