title: How can I obtain a list of all existing databases in DB2 using the JDBC driver?
body: <p>Through the DB2 command line I can obtain a <a href="https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001961.html?cp=SSEPGG_9.7.0%2F3-6-2-4-64" rel="nofollow">list of all existing database</a> through this command:</p>
  
  <pre><code>LIST DATABASE DIRECTORY
  </code></pre>
  
  <p>Is there away to do something similar from a JDBC app?</p>
  
  <p>My goal is to delete a bunch of databases that start with a specific name.
  Example:</p>
  
  <pre><code>XYZ01
  XYZ02
  XYZ07
  FOO01
  </code></pre>
  
  <p>I want to delete every database starts with XYZ.</p>
  
  <p>Is there some kind of metadata database that contain such information?</p>