public List<String> getDatabasesByPattern(String databasePattern) throws HiveException {
    try {
      return getMSC().getDatabases(databasePattern);
    } catch (Exception e) {
      throw new HiveException(e);
    }
  }
Get all existing databases that match the given
pattern. The matching occurs as per Java regular expressions

@param databasePattern
         java re pattern
@return list of database names
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java