\[ -a x^2 y(x)+a x+x^2 \left (y'(x)-y(x)^2\right )+2=0 \] ✓ Mathematica : cpu = 0.187412 (sec), leaf count = 113
\[\left \{\left \{y(x)\to -\frac {\frac {1}{a^3 x^2}+c_1 \left (\frac {e^{a x} \left (a^2 x+a (a x-2)\right )}{x}-\frac {e^{a x} (a x (a x-2)+2)}{x^2}+\frac {a e^{a x} (a x (a x-2)+2)}{x}\right )}{\frac {c_1 e^{a x} (a x (a x-2)+2)}{x}-\frac {1}{a^3 x}}\right \}\right \}\]
✓ Maple : cpu = 0.091 (sec), leaf count = 61
\[ \left \{ y \left ( x \right ) =-{\frac { \left ( {a}^{3}{x}^{3}-{a}^{2}{x}^{2}+2\,ax-2 \right ) {{\rm e}^{ax}}-{\it \_C1}}{x \left ( \left ( {a}^{2}{x}^{2}-2\,ax+2 \right ) {{\rm e}^{ax}}+{\it \_C1} \right ) }} \right \} \]