code: protected String[] getDatabaseSchemaNames(Database database) throws SQLException, DatabaseException {
          List<String> returnList = new ArrayList<>();
  
          ResultSet schemas = null;
          try {
              schemas = ((JdbcConnection) database.getConnection()).getMetaData().getSchemas();
              while (schemas.next()) {
                  returnList.add(JdbcUtils.getValueForColumn(schemas, "TABLE_SCHEM", database));
              }
          } finally {
              if (schemas != null) {
                  schemas.close();
              }
          }
  
          return returnList.toArray(new String[returnList.size()]);
      }
docs: Fetches an array of Strings with the schema names in the database.
  @param database The database from which to get the schema names
  @return An array of schema name Strings (May be an empty array)
  @throws SQLException propagated java.sql.SQLException
  @throws DatabaseException if a different problem occurs during the DBMS-specific code