I have added code tags, and broken some of the long lines; you can see how much better your code looks Beware on this forum: tick the disable smilies box otherwise :odbc turns into dbc.
But you haven’t told us what goes wrong; we can’t help if we don’t know. Do you suffer an Exception? If so, please show us the stack trace. Do you need a password?