public QTestMetaStoreHandler setMetaStoreConfiguration(HiveConf conf) {
    conf.setVar(ConfVars.METASTORE_DB_TYPE, getDbTypeConfString());

    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY, rule.getJdbcUrl());
    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECTION_DRIVER, rule.getJdbcDriver());
    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECTION_USER_NAME, rule.getHiveUser());
    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.PWD, rule.getHivePassword());
    // In this case we can disable auto_create which is enabled by default for every test
    MetastoreConf.setBoolVar(conf, MetastoreConf.ConfVars.AUTO_CREATE_ALL, false);

    LOG.info(String.format("set metastore connection to url: %s",
        MetastoreConf.getVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY)));

    return this;
  }
QTestMetaStoreHandler is responsible for wrapping the logic of handling different metastore
databases in qtests.
itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestMetaStoreHandler.java