\[ -a x^2 y(x)+a x+x^2 \left (y'(x)-y(x)^2\right )+2=0 \] ✓ Mathematica : cpu = 0.176258 (sec), leaf count = 109
\[\left \{\left \{y(x)\to \frac {a^6 c_1 x^3 e^{a x}-a^5 c_1 x^2 e^{a x}+2 a^4 c_1 x e^{a x}-2 a^3 c_1 e^{a x}+1}{a^5 c_1 x^3 \left (-e^{a x}\right )+2 a^4 c_1 x^2 e^{a x}-2 a^3 c_1 x e^{a x}+x}\right \}\right \}\]
✓ Maple : cpu = 0.094 (sec), leaf count = 52
\[ \left \{ y \left ( x \right ) ={\frac {- \left ( ax-1 \right ) \left ( {a}^{2}{x}^{2}+2 \right ) {{\rm e}^{ax}}+{\it \_C1}}{ \left ( \left ( {a}^{2}{x}^{2}-2\,ax+2 \right ) {{\rm e}^{ax}}+{\it \_C1} \right ) x}} \right \} \]