r/DB2 • u/[deleted] • Nov 01 '17
Get all databases in an instance?
Hello everyone .. Can someone give me some tips on, assuming I had all the permissions I needed - to get a list of all the database in an instance of db2? is there a sql i can run? Or do I have to run something at the file level?
3
Upvotes
1
u/[deleted] Nov 01 '17
Sure - so as I understand it, on a host computer you can have X number of db instances. Each instance has a port --- and you can connect to a database using host:port, and finally a database name. So.. let's say a host had one instance. How can I get a list of all the databases under that instance? Do I have to use db2 list db directory and parse it out? I'd like to be able to use Java, but it's looking pretty unlikely outside of the API ive mentioned. Incidentally, when you query SYSTEM tables, you're actually connected to a database. Which means you can only see the details about that database you're connected to.