DatabaseMetaData interface

You can use a DatabaseMetaData object to obtain information about the database as a whole as well as catalog information.

The following example shows how to return a list of tables, which is a catalog function:

     // Connect to the server.
     Connection c = DriverManager.getConnection("jdbc:as400://mySystem");

     // Get the database metadata from the connection.
     DatabaseMetaData dbMeta = c.getMetaData();

     // Get a list of tables matching the following criteria.
     String catalog = "myCatalog";
     String schema  = "mySchema";
     String table   = "myTable%"; // % indicates search pattern
     String types[]  = {"TABLE", "VIEW", "SYSTEM TABLE"};
     ResultSet rs = dbMeta.getTables(catalog, schema, table, types);

     // Iterate through the ResultSet to get the values.

     // Close the Connection.
     c.close();