Welcome to the Ranch
I have added code tags to your code, which make it look much better and clicked the disable smilies box, so :odbc doesn’t appear as dbc.
What exactly goes wrong? Do you suffer an Exception? It would be better to use ex.printStackTrace();, so you would know the exact details of the Exception, including where it occurred. How did you add that driver to your classpath?