I have tried that before, with no difference in output. Could it be the port number? I followed the code examples exactly, and changed nothing.
1) Check port number on which mysql is running
2) Prefer giving password to db
3) e.printStacktrace - put this in catch block