You got that, I presume, by multiplying both sides by and integrating. Of course, that is valid only as long as the denominator of the derivative is not 0- that is as long as . At points where it is 0, that is where y= 0 or y= 2, the denominator is 0 so the derivative does not exist (in other words, the graph has a vertical tangent). Since y lies between 0 and 2, this solution must be valid only for y between 0 and 2.
Now, if you put y= 0 in your solution, you get and it is not too difficult to see that x= 1 is a solution to that. and has no real roots so x= 1 is the only real solution.
If you put y= 2 in your solution, you get and it is not difficult to see that x= -1 is the only real solution to that equation. Since x=0 is between -1 and 1, we see that this solution is valid only for x between -1 and 1- that is, |x|< 1.