org.deegree.commons.utils
Class JDBCUtils

java.lang.Object
  extended by org.deegree.commons.utils.JDBCUtils

public final class JDBCUtils
extends java.lang.Object

This class contains static utility methods for working with JDBC.

Version:
$Revision: 27880 $, $Date: 2010-11-09 14:47:55 +0100 (Di, 09. Nov 2010) $
Author:
Oliver Tonnhofer, last edited by: $Author: mschneider $

Constructor Summary
JDBCUtils()
           
 
Method Summary
static void close(java.sql.Connection conn)
          Close the object, suppress all errors/exceptions.
static void close(java.sql.ResultSet resultSet)
          Close the object, suppress all errors/exceptions.
static void close(java.sql.ResultSet rs, java.sql.Statement stmt, java.sql.Connection conn, org.slf4j.Logger log)
          Tries to close each object from a ResultSet, Statement, Connection triple.
static void close(java.sql.Statement stmt)
          Close the object, suppress all errors/exceptions.
static java.lang.String getMessage(java.sql.SQLException e)
           
static void log(java.sql.SQLException e, org.slf4j.Logger log)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCUtils

public JDBCUtils()
Method Detail

log

public static void log(java.sql.SQLException e,
                       org.slf4j.Logger log)

getMessage

public static java.lang.String getMessage(java.sql.SQLException e)

close

public static void close(java.sql.Connection conn)
Close the object, suppress all errors/exceptions. Useful for finally clauses.

Parameters:
conn -

close

public static void close(java.sql.ResultSet resultSet)
Close the object, suppress all errors/exceptions. Useful for finally clauses.

Parameters:
resultSet -

close

public static void close(java.sql.Statement stmt)
Close the object, suppress all errors/exceptions. Useful for finally clauses.

Parameters:
stmt -

close

public static void close(java.sql.ResultSet rs,
                         java.sql.Statement stmt,
                         java.sql.Connection conn,
                         org.slf4j.Logger log)
Tries to close each object from a ResultSet, Statement, Connection triple. Useful for cleaning up in finally clauses.

Parameters:
rs - ResultSet to be closed
stmt - Statement to be closed
conn - Connection to be closed
log - used to log error messages, may be null


Copyright © 2011. All Rights Reserved.