org.geotools.data.jdbc
Class JDBCUtils

java.lang.Object
  extended byorg.geotools.data.jdbc.JDBCUtils

public class JDBCUtils
extends java.lang.Object

Version:
$Id: JDBCUtils.java 17701 2006-01-23 00:00:51Z desruisseaux $ Last Modified: $Date: 2003/11/28 08:49:51 $
Author:
Sean Geoghegan, Defence Science and Technology Organisation, $Author: seangeo $

Method Summary
static void close(java.sql.Connection conn, Transaction transaction, java.sql.SQLException sqlException)
          A utility method for closing a Connection.
static void close(java.sql.ResultSet rs)
          A utility method for closing a ResultSet.
static void close(java.sql.Statement statement)
          A utility method for closing a Statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public static void close(java.sql.Statement statement)
A utility method for closing a Statement. Wraps and logs any exceptions thrown by the close method.

Parameters:
statement - The statement to close. This can be null since it makes it easy to close statements in a finally block.

close

public static void close(java.sql.ResultSet rs)
A utility method for closing a ResultSet. Wraps and logs any exceptions thrown by the close method.

Parameters:
rs - The ResultSet to close. This can be null since it makes it easy to close result sets in a finally block.

close

public static void close(java.sql.Connection conn,
                         Transaction transaction,
                         java.sql.SQLException sqlException)
A utility method for closing a Connection. Wraps and logs any exceptions thrown by the close method.

Connections are maintained by a Transaction and we will need to manage them with respect to their Transaction.

Jody here - I am forcing this to be explicit, by requiring you give the Transaction context when you close a connection seems to be the only way to hunt all the cases down. AttributeReaders based on QueryData rely on

I considered accepting an error flag to control Transaction rollback, but I really only want to capture SQLException that force transaction rollback.

Parameters:
conn - The Connection to close. This can be null since it makes it easy to close connections in a finally block.
transaction - Context for the connection, we will only close the connection for Transaction.AUTO_COMMIT
sqlException - Error status, null for no error


Copyright © GeoTools. All Rights Reserved.