|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.dbutils.CloseResources
public class CloseResources
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 2003 Rakesh Vidyadharan
| Field Summary | |
|---|---|
static boolean |
CLOSE_ASSOCIATED_RESOURCES
A constant used to indicate that all the JDBC resources associated with the specified resource should be closed. |
static boolean |
CLOSE_SPECIFIED_RESOURCE
A constant used to indicate that only the specified JDBC resource should be closed. |
private static java.util.logging.Logger |
logger
The logger instance used to log errors or other messages. |
| Constructor Summary | |
|---|---|
private |
CloseResources()
Default constructor. |
| Method Summary | |
|---|---|
static void |
close(java.sql.Connection connection)
Utility method to close the specified Connection in
a fail-safe manner. |
static void |
close(java.sql.Connection connection,
boolean autoCommit)
Utility method to close the specified Connection in
a fail-safe manner. |
static void |
close(java.sql.ResultSet resultSet)
Utility method to close the specified ResultSet in
a fail-safe manner. |
static void |
close(java.sql.ResultSet resultSet,
boolean closeAssociatedResources)
Utility method to close the specified ResultSet in
a fail-safe manner. |
static void |
close(java.sql.Statement statement)
Utility method to close the specified Statement in
a fail-safe manner. |
static void |
close(java.sql.Statement statement,
boolean closeAssociatedResources)
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 |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final boolean CLOSE_SPECIFIED_RESOURCE
false
public static final boolean CLOSE_ASSOCIATED_RESOURCES
| Constructor Detail |
|---|
private CloseResources()
| Method Detail |
|---|
public static void close(java.sql.ResultSet resultSet)
ResultSet in
a fail-safe manner. Any errors encountered while closing the
result set will be logged to logger as a warning.
resultSet - The result set that is to be closed.
public static void close(java.sql.ResultSet resultSet,
boolean closeAssociatedResources)
ResultSet in
a fail-safe manner. If the closeAssociatedResources
parameter is set to CLOSE_ASSOCIATED_RESOURCES, then the
Statement and Connection associated with
the specified result set are closed, otherwise, only the specifed
result set will be closed.
resultSet - The result set that is to be closed.closeAssociatedResources - The flag indicating the resources
that are to be closed.close( ResultSet ),
close( Statement ),
close( Connection )public static void close(java.sql.Statement statement)
Statement in
a fail-safe manner. Any errors encountered while closing the
statement will be logged to logger as a warning.
statement - The statement that is to be closed.
public static void close(java.sql.Statement statement,
boolean closeAssociatedResources)
Statement in
a fail-safe manner. If the closeAssociatedResources
parameter is set to CLOSE_ASSOCIATED_RESOURCES, then the
Connection associated with the specified statement is
also closed, otherwise, only the specifed statement will be closed.
statement - The statement that is to be closed.closeAssociatedResources - The flag indicating the resources
that are to be closed.close( Statement ),
close( Connection )public static void close(java.sql.Connection connection)
Connection in
a fail-safe manner. Any errors encountered while closing the
connection will be logged to logger as a warning.
connection - The connection that is to be closed.
public static void close(java.sql.Connection connection,
boolean autoCommit)
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.
connection - The connection that is to be closed.autoCommit - The value to set for the autoCommit property.close( Connection )
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||