private static DbType getDbType(String productName) {
    DbType dbt;
    productName = productName.replaceAll("\\s+", "").toLowerCase();

    if (productName.contains(DERBY_NAME)) {
      dbt = DbType.DERBY;
    } else if (productName.contains(SQL_SERVER_NAME)) {
      dbt = DbType.SQLSERVER;
    } else if (productName.contains(MYSQL_NAME) || productName.contains(MARIADB_NAME)) {
      dbt = DbType.MYSQL;
    } else if (productName.contains(ORACLE_NAME)) {
      dbt = DbType.ORACLE;
    } else if (productName.contains(POSTGRESQL_NAME)) {
      dbt = DbType.POSTGRES;
    } else {
      dbt = DbType.UNDEFINED;
    }
    return dbt;
  }
Determine the database product type
@param productName string to defer database connection
@return database product type
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java