# Difference between Mantel-Haenszel and correlation coefficient test

Reading this online course or the SAS documentation (search for "correlation statistic, popularized by Mantel and Haenszel"), I came across this Mantel-Haenszel test of correlation (bold is my note) :

Mantel-Haenszel (MH) statistic, M2, applies to both the Pearson and Spearman correlation. It tests the null hypothesis of independence with ordinal variables (i.e., correlation parameter, ρ, is equal to zero) versus the two-sided alternative:

H0 : ρ = 0 H0 : ρ ≠ 0 (Shouldn't be H1 in second ?)

where the test statistic is

M²=(n−1)r²

When H0 is true, then M2 has approximately chi-square distribution with df = 1.

On the other hand, the correlation test I learnt during my education was the one described here :

t-test for testing the population correlation coefficient H0: ρ = 0.

$t = \frac{r\sqrt{n-2}}{\sqrt{1-r²}}$

The P-value is determined by referring to a t-distribution with df = n-2.

What is the difference between those 2 tests ? How can I know which one I should use ?

Can I use both tests on both Spearman and Pearson correlation coefficient ?