Thanks in advance... for what? You don't seem to be asking a question here. Generally speaking, the best way to get help around here is to ask simple, focused, and direct questions. What 99% of the folks who look at your post are going to do is say "well, I see a hundred lines of code and no indication of what the poster wants, so I'll spend my time elsewhere".
Because you don't close the resultset/statment/connection after each loop - or after each 100th or 200th or XXth (less then the max open cursors, plus a margin if the connection are used to other SQL stuff) loop...
If you don't close both the resultset/statment/connection they count for three open cursors.
Rajesh, Also note that you could optimize this whole thing to make it one SQL statement. It's still important to close the resources properly (in a finally block.) This approach is faster and uses less resources though.
Consider if you changed the checkAccountNo method signature to:
This method would return all the account numbers found in the table from the list of candidate ones. This is one SQL query and not a whole bunch of them. Then in Java you can loop through and handle the missing ones.
Or this one:
This method would return the number of matching accounts found in the table from the list of candidate ones. Since the if statement doesn't seem to care which accounts aren't found, this would be even faster because you don't have to send a list of account ids back from the database.