2. The real number sequence $\left\{a_{n}\right\}$ is defined as, $a_{1}=1, a_{9}=7$,
$$
a_{n+1}=\frac{a_{n}^{2}-a_{n-1}+2 a_{n}}{a_{n-1}+1}, n=2,3, \cdots
$$

Then the value of $a_{5}$ is ( ).
(A) 3
(B) -4
(C) 3 or -4
(D) 8
2. A.

Let $b_{n}=a_{n}+1$, then
$$
b_{n+1}-1=\frac{b_{n}^{2}-b_{n-1}}{b_{n-1}}=\frac{b_{n}^{2}}{b_{n-1}}-1 .
$$

Therefore, $b_{n}^{2}=b_{n+1} b_{n-1}$. Hence $b_{5}^{2}=b_{1} b_{9}=16$.
Thus, $b_{5}=4$ (discard -4, as $b_{1} 、 b_{5} 、 b_{9}$ have the same sign).