Seetharaman Venkatasamy wrote:In Rob code, I just feel the many nested try finally may make less readability! but what I made the method above encapsulate the closing part. is not it? correct me If I am wrong please 
I don't like to either include or re-implement a utility class all over the place, so my approach will work everywhere. However, once I switch to Java 7, I'll definitely use the try-with-resources version. It's shorter, and handles the closing for you.
Jon Camilleri wrote:Why are you enclosing each .close() within a try..catch block, rather than grouping them? I'm afraid this would be slightly less efficient than grouping them, hence, JVM would process the nested statements faster, than a series of try..catch blocks. What do you think?
Because each of the close() methods can throw an SQLException. If that occurs, you still want the others to be closed (if possible). But again, this is something that the try-with-resources will do for you.