public Collection<String> listTables() throws DatabaseException {
  Collection<String> result=new ArrayList<String>();
  ResultSet rs=null;
  try {
    DatabaseMetaData dbm=connection.getMetaData();
    String types[]={"TABLE"};
    rs=dbm.getTables(null,null,null,types);
    while (rs.next()) {
      String str=rs.getString("TABLE_NAME");
      result.add(str);
    }
  }
 catch (  SQLException e) {
    throw (new DatabaseException(e));
  }
 finally {
    if (rs != null) {
      try {
        rs.close();
      }
 catch (      SQLException e) {
      }
    }
  }
  return result;
}

public Collection < String > listTables ( ) throws DatabaseException { Collection < String > result = new ArrayList < String > ( ) ; ResultSet rs = null ; try { DatabaseMetaData dbm = connection . getMetaData ( ) ; String types [ ] = { "TABLE" } ; rs = dbm . getTables ( null , null , null , types ) ; while ( rs . next ( ) ) { String str = rs . getString ( "TABLE_NAME" ) ; result . add ( str ) ; } } catch ( SQLException e ) { throw ( new DatabaseException ( e ) ) ; } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( SQLException e ) { } } } return result ; }
get a list of all tables in the database .
