Use
e.printStackTrace() in your
catch clause. That way you'll see much more information about the exception. It might even help you figure out what's going on. (In production code,
you should set up a logging system in your app and write diagnostic messages (and exceptions) to the log.)
The problem is that when you open a resultset, the current position points to a position just before the first row. So there is no current row and you cannot access its fields. After opening a resultset, you need to call
next(). If the first call to
next() return false, there were no rows returned by your query.
I'd suggest reading the
JDBC tutorial, if you haven't done so yet. It is a very good introduction into
JDBC.