code: public static Dialect guessDialect(DataSource dataSource) {
  		Dialect result = dataSourceDialectCache.get(dataSource);
  		if (result != null)
  			return result;
  		Connection con = null;
  		try {
  			con = dataSource.getConnection();
  			result = guessDialect(con);
  			if (result == null)
  				return (Dialect) DialectException
  						.throwEX("Can not get dialect from DataSource, please submit this bug.");
  			dataSourceDialectCache.put(dataSource, result);
  			return result;
  		} catch (SQLException e) {
  			return (Dialect) DialectException.throwEX(e);
  		} finally {
  			try {
  				if (con != null && !con.isClosed()) {
  					try {// NOSONAR
  						con.close();
  					} catch (SQLException e) {
  						DialectException.throwEX(e);
  					}
  				}
  			} catch (SQLException e) {
  				DialectException.throwEX(e);
  			}
  		}
  	}
docs: Guess dialect based on given dataSource
  
  @param datasource
  The dataSource
  @return dialect or null if can not guess out which dialect