4. Indeterminate equation
$$
3 x^{2}+7 x y-2 x-5 y-17=0
$$

all positive integer solutions $(x, y)$ have $(\quad)$ groups.
(A) 1
(B) 2
(C) 3
(D) 4
4. B.

From the given conditions, we have
$$
y=\frac{-3 x^{2}+2 x+17}{7 x-5} \text {. }
$$

Since $x$ and $y$ are positive integers, it follows that
$$
-3 x^{2}+2 x+17 \geqslant 7 x-5 \text {. }
$$

Therefore, $3 x^{2}+5 x \leqslant 22$.
Thus, $x=1$ or 2.
When $x=1$, $y=8$; when $x=2$, $y=1$.
In conclusion, $(x, y)=(1,8),(2,1)$.