|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJDBCUtils
public class JDBCUtils
Utility class helping developers to safely clean up after connections.
Although this class is not used directly by the org.geotools.jdbc classes it is used downstream in GeoServer.
Method Summary | |
---|---|
static void |
close(Connection conn,
Transaction transaction,
SQLException sqlException)
A utility method for closing a Connection. |
static void |
close(ResultSet rs)
A utility method for closing a ResultSet. |
static void |
close(Statement statement)
A utility method for closing a Statement. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void close(Statement statement)
statement
- The statement to close. This can be null since it makes
it easy to close statements in a finally block.public static void close(ResultSet rs)
rs
- The ResultSet to close. This can be null since it makes it
easy to close result sets in a finally block.public static void close(Connection conn, Transaction transaction, SQLException sqlException)
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.
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_COMMITsqlException
- Error status, null
for no error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |