Hum, that code works perfectly for me. I would suspect that one of the values such as the password or the database name/username that you have commented out, contain a ' or a " which would create errors, you can escape them by using a back slash ( \ ) before the character.