private static DatabaseRule getDatabaseRule(String metastoreType) {
    switch (metastoreType) {
      case "postgres":
        return new Postgres();
      case "oracle":
        return new Oracle();
      case "mysql":
        return new Mysql();
      case "mariadb":
        return new Mariadb();
      case "mssql":
        return new Mssql();
      default:
        return new Derby();
    }
  }
Test class to run DbTxnManager tests against different dbms types.
Example: mvn test -Dtest=ITestDbTxnManager -Dtest.metastore.db=postgres
ql/src/test/org/apache/hadoop/hive/ql/lockmgr/ITestDbTxnManager.java