Im pretty sure your issue is that you are in a result set, looping and creating new statement(s) and new result set(s) within the loop. Meaning, within rs.next(). Not to be "unhelpful" I didnt look super closely, but I think thats your issue. You cant do that.
If you need to retreive data, then use this data to retrieve something else in a loop, create two sections of code, one that retreives the criteria and stores it in say an ArrayList, then close and clean up your statements and result sets and start a new loop thru the ArrayList doing your second set of SQL. Be sure to clean up as you loop around each time.