Here you can find the source of closeResultSet(ResultSet rs)
public static void closeResultSet(ResultSet rs)
//package com.java2s; /**/*ww w.jav a2s . c om*/ * (C) 2010-2011 Alibaba Group Holding Limited. * <p/> * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public static void closeResultSet(ResultSet rs) { try { if (null != rs) { Statement stmt = rs.getStatement(); if (null != stmt) { stmt.close(); stmt = null; } rs.close(); } rs = null; } catch (SQLException e) { throw new IllegalStateException(e.getCause()); } } }