Created a utility class to easy closing statements and connections and

such.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@18 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2000-12-06 00:27:30 +00:00
parent ce2bdb4829
commit 70c8004f02
2 changed files with 45 additions and 0 deletions
@@ -0,0 +1,36 @@
//
// $Id: JDBCUtil.java,v 1.1 2000/12/06 00:27:30 mdb Exp $
package com.samskivert.jdbc;
import java.sql.*;
/**
* A repository for JDBC related utility functions.
*/
public class JDBCUtil
{
/**
* Closes the supplied JDBC statement and gracefully handles being
* passed null (by doing nothing).
*/
public static void close (Statement stmt)
throws SQLException
{
if (stmt != null) {
stmt.close();
}
}
/**
* Closes the supplied JDBC connection and gracefully handles being
* passed null (by doing nothing).
*/
public static void close (Connection conn)
throws SQLException
{
if (conn != null) {
conn.close();
}
}
}
@@ -0,0 +1,9 @@
#
# $Id: Makefile,v 1.1 2000/12/06 00:27:30 mdb Exp $
ROOT = ../../..
SRCS = \
JDBCUtil.java \
include $(ROOT)/build/Makefile.java