DSolve[-((a + (-1 + n)*n*Csc[x]^2 + (-1 + m)*m*Sec[x]^2)*y[x]) + Derivative[2][y][x] == 0,y[x],x]