My problem is that I have to set a variable in a try statement otherwise I get a compile error.
Later on I need to use that variable but it is now out of scope, or s
Why don't you simply add a
if(rs != null)
before
while(rs.next())
This should help (as far as I understand it)