Here you can find the source of close(ResultSet _rsData, Logger _logger)
Parameter | Description |
---|---|
_rsData | data result set to close |
_logger | logger to record message if encounters errors. |
public static void close(ResultSet _rsData, Logger _logger)
//package com.java2s; /**//w ww . ja va2 s.c o m * PureInfo Force * @(#)DBUtil.java 1.0 2005-7-23 * * Copyright(c) 2004-2005, PureInfo Information Technology Corp. Ltd. * All rights reserved, see the license file. * * www.pureinfo.com.cn */ import java.sql.ResultSet; import java.sql.Statement; import org.apache.log4j.Logger; public class Main { /** * Closes a result set * * @param _rsData * data result set to close * @param _logger * logger to record message if encounters errors. */ public static void close(ResultSet _rsData, Logger _logger) { if (_rsData == null) return; //else try { _rsData.close(); } catch (Exception ex) { if (_logger == null) { ex.printStackTrace(System.err); } else { _logger.error("failed to close ResultSet", ex); } } } /** * Closes a statement * * @param _rsData * statement to close * @param _logger * logger to record message if encounters errors. */ public static void close(Statement _statement, Logger _logger) { if (_statement == null) return; //else try { _statement.close(); } catch (Exception ex) { if (_logger == null) { ex.printStackTrace(System.err); } else { _logger.error("failed to close Statement", ex); } } } /** * Closes a result set and related statement * * @param _rsData * data result set to close * @param _statement * related statement * @param _logger * logger to record message if encounters errors. */ public static void close(ResultSet _rsData, Statement _statement, Logger _logger) { close(_rsData, _logger); close(_statement, _logger); } }