SPT Core API

com.sptci.util
Class CloseJDBCResources

java.lang.Object
  extended by com.sptci.util.CloseJDBCResources

public class CloseJDBCResources
extends Object

A convenience class to close JDBC resources in an error free manner. Any errors encountered while closing the resources will be logged using the logger. You can configure the location and other properties for the logger through the logging.properties file.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: CloseJDBCResources.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2007-09-19

Constructor Summary
CloseJDBCResources()
           
 
Method Summary
static void close(Connection connection)
          Utility method to close the specified Connection in a fail-safe manner.
static void close(Connection connection, boolean autoCommit)
          Utility method to close the specified Connection in a fail-safe manner.
static void close(ResultSet resultSet)
          Utility method to close the specified ResultSet in a fail-safe manner.
static void close(Statement statement)
          Utility method to close the specified Statement in a fail-safe manner.
static void closeAll(ResultSet resultSet)
          Utility method to close the specified ResultSet in a fail-safe manner.
static void closeAll(Statement statement)
          Utility method to close the specified Statement in a fail-safe manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloseJDBCResources

public CloseJDBCResources()
Method Detail

close

public static void close(ResultSet resultSet)
Utility method to close the specified ResultSet in a fail-safe manner. Any errors encountered while closing the result set will be logged to logger as a warning.

Parameters:
resultSet - The result set that is to be closed.

closeAll

public static void closeAll(ResultSet resultSet)
Utility method to close the specified ResultSet in a fail-safe manner. The Statement and Connection associated with the specified result set are also closed.

Parameters:
resultSet - The result set that is to be closed.
See Also:
close( ResultSet ), close( Statement ), close( Connection )

close

public static void close(Statement statement)
Utility method to close the specified Statement in a fail-safe manner. Any errors encountered while closing the statement will be logged to logger as a warning.

Parameters:
statement - The statement that is to be closed.

closeAll

public static void closeAll(Statement statement)
Utility method to close the specified Statement in a fail-safe manner. The Connection associated with the specified statement is also closed.

Parameters:
statement - The statement that is to be closed.
See Also:
close( Statement ), close( Connection )

close

public static void close(Connection connection)
Utility method to close the specified Connection in a fail-safe manner. Any errors encountered while closing the connection will be logged to logger as a warning.

Parameters:
connection - The connection that is to be closed.

close

public static void close(Connection connection,
                         boolean autoCommit)
Utility method to close the specified Connection in a fail-safe manner. Set the autoCommit property of the connection to the specified value. Any errors encountered while closing the connection will be logged to logger as a warning.

Parameters:
connection - The connection that is to be closed.
autoCommit - The value to set for the autoCommit property.
See Also:
close( Connection )

SPT Core API