code: public static DatabaseVendor detectDbVendor(Connection conn) throws SQLException {
          DatabaseMetaData dmd = conn.getMetaData();
          String dpn = dmd.getDatabaseProductName();
          if (StringUtils.equalsAnyIgnoreCase("MySQL", dpn)) {
              return DatabaseVendor.MYSQL;
          }
          if (StringUtils.equalsAnyIgnoreCase("PostgreSQL", dpn)) {
              return DatabaseVendor.POSTGRESQL;
          }
          if (StringUtils.equalsAnyIgnoreCase("Microsoft SQL Server", dpn)) {
              return DatabaseVendor.MSSQL;
          }
          return DatabaseVendor.UNKNOWN;
      }
docs: Detect database vender info.
  
  @param conn
  @return
  @throws SQLException