code: public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException {        
          final String query = "SELECT schema_name table_schem, " +
                  "null table_catalog " +
                  "FROM information_schema.schemata " +
                  (schemaPattern != null ? "WHERE schema_name like '" + schemaPattern + "'" : "") +
                  " ORDER BY table_schem";
          final Statement stmt = connection.createStatement();
          return stmt.executeQuery(query);
      }
docs: Retrieves the schema names available in this database.  The results are ordered by <code>TABLE_CATALOG</code> and
  <code>TABLE_SCHEM</code>.
  <p/>
  <P>The schema columns are: <OL> <LI><B>TABLE_SCHEM</B> String => schema name <LI><B>TABLE_CATALOG</B> String =>
  catalog name (may be <code>null</code>) </OL>
  
  @param catalog       a catalog name; must match the catalog name as it is stored in the database;"" retrieves
  those without a catalog; null means catalog name should not be used to narrow down the
  search.
  @param schemaPattern a schema name; must match the schema name as it is stored in the database; null means schema
  name should not be used to narrow down the search.
  @return a <code>ResultSet</code> object in which each row is a schema description
  @throws java.sql.SQLException if a database access error occurs
  @see #getSearchStringEscape
  @since 1.6