297*. Find all real $x$ for which the fraction

$$
\frac{x^{2}+2 x-3}{x^{2}+1}
$$

takes integer values.
$\triangle$ Note that the number $x$, in general, is not an integer, so the methods used in previous problems are of little help.

Let

$$
\frac{x^{2}+2 x-3}{x^{2}+1}=a
$$

where the number $a$ is an integer. Simplify the expression:

$$
x^{2}+2 x-3=a x^{2}+a, \quad(a-1) x^{2}-2 x+(a+3)=0
$$

Consider two cases.

1) Let $a=1$. Then the last equation becomes linear. Solve for $x$:

$$
-2 x+4=0, \quad x=2
$$

2) Let $a \neq 1$. In this case, the equation is quadratic. Its discriminant $D$ must be non-negative:

$$
\frac{1}{4} D=1-(a-1)(a+3) \geqslant 0, \quad 1-a^{2}+a-3 a \geqslant 0, \quad a^{2}+2 a-4 \geqslant 0
$$

The last inequality needs to be solved in integers. The roots of the quadratic trinomial on its left side are $-1 \pm \sqrt{5}$, so the inequality is equivalent to:

$$
-1-\sqrt{5} \leqslant a \leqslant-1+\sqrt{5}
$$

Considering that $\sqrt{5} \approx 2.2$, we get the following integer solutions to the inequality:

$$
-3,-2,-1,0,1 \text {. }
$$

The case $a=1$ has already been considered.

For $a=-3$, we have:

$$
-4 x^{2}-2 x=0, \quad 2 x^{2}+x=0 ; \quad x_{1}=0, \quad x_{2}=-1 / 2
$$

The cases $a=-2, a=-1$ and $a=0$ are considered similarly.

Answer: $-3,-1,-1 / 2,0,1 / 3,1,2,(-1 \pm \sqrt{5}) / 2$.