@Override
  public HCatDatabase getDatabase(String dbName) throws HCatException {
    HCatDatabase db = null;
    try {
      Database hiveDB = hmsClient.getDatabase(checkDB(dbName));
      if (hiveDB != null) {
        db = new HCatDatabase(hiveDB);
      }
    } catch (NoSuchObjectException exp) {
      throw new ObjectNotFoundException(
        "NoSuchObjectException while fetching database", exp);
    } catch (MetaException exp) {
      throw new HCatException("MetaException while fetching database",
        exp);
    } catch (TException exp) {
      throw new ConnectionFailureException(
        "TException while fetching database", exp);
    }
    return db;
  }
The HCatClientHMSImpl is the Hive Metastore client based implementation of
HCatClient.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java