DSolve[-Cot[a*x] + a^2*y[x] + Derivative[2][y][x] == 0,y[x],x]