\[ -a x^2 y(x)+a x+x^2 \left (y'(x)-y(x)^2\right )+2=0 \] ✓ Mathematica : cpu = 0.200223 (sec), leaf count = 122
DSolve[2 + a*x - a*x^2*y[x] + x^2*(-y[x]^2 + Derivative[1][y][x]) == 0,y[x],x]
\[\left \{\left \{y(x)\to -\frac {\frac {e^{a x} \left (a^2 x^2-2 a x+2\right )}{a^2 x}-\frac {e^{a x} \left (a^2 x^2-2 a x+2\right )}{a^3 x^2}+\frac {e^{a x} \left (2 a^2 x-2 a\right )}{a^3 x}-\frac {c_1}{x^2}}{\frac {e^{a x} \left (a^2 x^2-2 a x+2\right )}{a^3 x}+\frac {c_1}{x}}\right \}\right \}\] ✓ Maple : cpu = 0.102 (sec), leaf count = 52
dsolve(x^2*(diff(y(x),x)-y(x)^2)-a*x^2*y(x)+a*x+2 = 0,y(x))
\[y \left (x \right ) = \frac {-\left (a x -1\right ) \left (a^{2} x^{2}+2\right ) {\mathrm e}^{a x}+c_{1}}{x \left (\left (a^{2} x^{2}-2 a x +2\right ) {\mathrm e}^{a x}+c_{1}\right )}\]