@Override
  public List<Database> getDatabaseObjects(String catName, String pattern) throws MetaException {
    boolean commited = false;
    List<Database> databases = new ArrayList<>();
    Query query = null;
    catName = normalizeIdentifier(catName);
    try {
      openTransaction();
      StringBuilder filterBuilder = new StringBuilder();
      List<String> parameterVals = new ArrayList<>();
      appendSimpleCondition(filterBuilder, "catalogName", new String[]{catName}, parameterVals);
      if (!(pattern == null || pattern.equals("*"))) {
        String[] subpatterns = pattern.trim().split("\\|");
        appendPatternCondition(filterBuilder, "name", subpatterns, parameterVals);
      }
      query = pm.newQuery(MDatabase.class, filterBuilder.toString());
      query.setOrdering("name ascending");
      Collection<MDatabase> mDBs = (Collection<MDatabase>) query.executeWithArray(parameterVals.toArray(new String[0]));
      for (MDatabase mdb : mDBs) {
        databases.add(convertToDatabase(mdb));
      }
      commited = commitTransaction();
    } finally {
      rollbackAndCleanup(commited, query);
    }
    return databases;
  }
Alter the database object in metastore. Currently only the parameters
of the database or the owner can be changed.
@param dbName the database name
@param db the Hive Database object
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java