Solution (source code)

= Solution

An <integrating factor> is
$$
I(x)=\exp\int\frac{x}{a^2+x^2}\,dx=\sqrt{a^2+x^2}.
$$
Multiplying the <linear ordinary differential equation> by it gives
$$
\frac{d}{dx}\left(y\sqrt{a^2+x^2}\right)=x\sqrt{a^2+x^2}.
$$
The right-hand side integrates to $(a^2+x^2)^{3/2}/3$, so
$$
\boxed{y=\frac{a^2+x^2}{3}+\frac{C}{\sqrt{a^2+x^2}}}.
$$
This holds on every interval where the coefficient is defined. If $a=0$, intervals cannot cross $x=0$; equivalently the family is $y=x^2/3+C/x$ on either half-line, with an independently chosen constant.