Here you can find the source of closeResultSet(ResultSet rs)
Parameter | Description |
---|---|
rs | An open ResultSet |
public static void closeResultSet(ResultSet rs)
//package com.java2s; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; public class Main { /********************************** This will do the clean up of closing an open Statement, ResultSet and Connection if open. @since 2006.07.24/* w w w . j a v a 2 s. c o m*/ @param rs An open ResultSet **********************************/ public static void closeResultSet(ResultSet rs) { try { if (rs != null) { Statement s = rs.getStatement(); rs.close(); if (s != null) { Connection c = s.getConnection(); s.close(); if (c != null && !(c.isClosed())) { c.close(); } } } } catch (Exception e) { //Common.handleException(e); } } }