Ugh, judging by this JOptionPane stuff, I assume this is part of a GUI? In which case I HOPE that this is part of a SwingWorker, and even then the JOptionPane stuff is probably not usuable in this form, as otherwise this is running on the same thread as the GUI which will introduce all sorts of problems.

See the API docs SwingWorker and google for some examples.

I also do not see where you are declaring your connection and statements. I see where you are defining them, but not where you are declaring them, so I can only assume they are instance variables, which will, most likely, also lead to a whole host of problems. Declare them locally.

But, other than those two obvious and grave errors, what is the actual problem you're having?

always catch your exceptions as specific possible, don't just rely on the Exception class to do the Pokémon move and "Catch'em all!!"

neither of the above catch block's 'll inform you of what is actually going wrong. the first one 'll just tell you in what method you have a problem. be a bit more specific. add some logging, or print the ex.getMessage() text instead of a Generic message

the second catch is even worse, since it's hiding the exceptions. if something goes wrong there, how will you know?