'Query to list all the database in DB2
The general CLP command for listing the databases in DB2 "LIST ACTIVE DATABASES" what is the sql command to list all the database in a system directory?
Solution 1:[1]
Solution 2:[2]
Using Python :
In [42]: stmt = ibm_db.exec_immediate(conn, "SELECT DISTINCT(DB_NAME) FROM table(mon_get_memory_pool('','',-2))")
In [43]: while (ibm_db.fetch_row(stmt)):
...: DB_NAME = ibm_db.result(stmt, "DB_NAME")
...: print("DB_NAME = {}".format(DB_NAME))
...:
...:
DB_NAME = SAMPLE
DB_NAME = None
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MichaelTiefenbacher |
| Solution 2 | Nilesh Solanki |
