protected String [ ] getDatabaseCatalogNames ( Database database ) throws SQLException , DatabaseException { List < String > returnList = new ArrayList <> ( ) ; ResultSet catalogs = null ; try { if ( ( ( AbstractJdbcDatabase ) database ) . jdbcCallsCatalogsSchemas ( ) ) { catalogs = ( ( JdbcConnection ) database . getConnection ( ) ) . getMetaData ( ) . getSchemas ( ) ; } else { catalogs = ( ( JdbcConnection ) database . getConnection ( ) ) . getMetaData ( ) . getCatalogs ( ) ; } while ( catalogs . next ( ) ) { if ( ( ( AbstractJdbcDatabase ) database ) . jdbcCallsCatalogsSchemas ( ) ) { returnList . add ( catalogs . getString ( "TABLE_SCHEM" ) ) ; } else { returnList . add ( catalogs . getString ( "TABLE_CAT" ) ) ; } } } finally { if ( catalogs != null ) { try { catalogs . close ( ) ; } catch ( SQLException ignore ) { } } } return returnList . toArray ( new String [ returnList . size ( ) ] ) ; }
Fetches an array of Strings with the catalog names in the database .