17. (12 points) Ellipse $C$:
$A x^{2}+B y^{2}=1$ intersects with the line $l: x+2 y=7$ at points $P$ and $Q$. Point $R$ has coordinates $(2,5)$. If $\triangle P Q R$ is an isosceles right triangle, $\angle P R Q=90^{\circ}$, find the values of $A$ and $B$.
17. Since $\triangle P Q R$ is an isosceles right triangle, $\angle P R Q=90^{\circ}$, the distance from point $R$ to $P Q$ is $\frac{|2+2 \times 5-7|}{\sqrt{1^{2}+2^{2}}}=\sqrt{5}$, so,
$$
|R P|=|R Q|=\sqrt{2} \times \sqrt{5}=\sqrt{10} \text {. }
$$

Thus, points $P$ and $Q$ are the intersections of the circle with center $R$ and radius $\sqrt{10}$ with the line $l$. This gives us
$$
\left\{\begin{array}{l}
(x-2)^{2}+(y-5)^{2}=10 \\
x+2 y=7 .
\end{array}\right.
$$

Solving this, we get $x=-1, y=4$, or $x=3, y=2$.
Since points $P$ and $Q$ are on the ellipse $A x^{2}+B y^{2}=1$, we have
$$
\left\{\begin{array}{l}
A+16 B=1, \\
9 A+4 B=1 .
\end{array}\right.
$$

Solving this, we get $A=\frac{3}{35}, B=\frac{2}{35}$.