\[ \boxed { {x}^{2} \left ( {\frac {\rm d}{{\rm d}x}}y \left ( x \right ) - \left ( y \left ( x \right ) \right ) ^{2} \right ) -a{x}^{2}y \left ( x \right ) +ax+2=0} \]
Mathematica: cpu = 0.181523 (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.078 (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 \} \]