What do you mean by working exactly? You see lights on it and can eject the tray but Windows does not see it? Is this a laptop or a deskop? Did you move the case around right before this happened? Have you rebooted the PC? Check cables?
I had the same problem on my Dell inspiron B130 laptop, where the cd drive just dissapeared from my computer, so i took it to a repair guy, and he said that whenever it dissappears from the my computer folder just unscrew the actual drive and pop the whole thing out and then push it back in, and it worked.
Since then it has dissappeared once more and i just did what he said, and it came back again