|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.dbutils.DbUtils
public final class DbUtils
A collection of JDBC helper methods. This class is thread safe.
Constructor Summary | |
---|---|
DbUtils()
|
Method Summary | |
---|---|
static void |
close(java.sql.Connection conn)
Close a Connection , avoid closing if null. |
static void |
close(java.sql.ResultSet rs)
Close a ResultSet , avoid closing if null. |
static void |
close(java.sql.Statement stmt)
Close a Statement , avoid closing if null. |
static void |
closeQuietly(java.sql.Connection conn)
Close a Connection , avoid closing if null and hide
any SQLExceptions that occur. |
static void |
closeQuietly(java.sql.Connection conn,
java.sql.Statement stmt,
java.sql.ResultSet rs)
Close a Connection , Statement and
ResultSet . |
static void |
closeQuietly(java.sql.ResultSet rs)
Close a ResultSet , avoid closing if null and hide
any SQLExceptions that occur. |
static void |
closeQuietly(java.sql.Statement stmt)
Close a Statement , avoid closing if null and hide
any SQLExceptions that occur. |
static void |
commitAndClose(java.sql.Connection conn)
Commits a Connection then closes it, avoid closing if null. |
static void |
commitAndCloseQuietly(java.sql.Connection conn)
Commits a Connection then closes it, avoid closing if null
and hide any SQLExceptions that occur. |
static boolean |
loadDriver(java.lang.String driverClassName)
Loads and registers a database driver class. |
static void |
printStackTrace(java.sql.SQLException sqle)
|
static void |
printStackTrace(java.sql.SQLException sqle,
java.io.PrintWriter pw)
|
static void |
printWarnings(java.sql.Connection connection)
|
static void |
printWarnings(java.sql.Connection conn,
java.io.PrintWriter pw)
|
static void |
rollback(java.sql.Connection conn)
Rollback any changes made on the given connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbUtils()
Method Detail |
---|
public static void close(java.sql.Connection conn) throws java.sql.SQLException
Connection
, avoid closing if null.
java.sql.SQLException
public static void close(java.sql.ResultSet rs) throws java.sql.SQLException
ResultSet
, avoid closing if null.
java.sql.SQLException
public static void close(java.sql.Statement stmt) throws java.sql.SQLException
Statement
, avoid closing if null.
java.sql.SQLException
public static void closeQuietly(java.sql.Connection conn)
Connection
, avoid closing if null and hide
any SQLExceptions that occur.
public static void closeQuietly(java.sql.Connection conn, java.sql.Statement stmt, java.sql.ResultSet rs)
Connection
, Statement
and
ResultSet
. Avoid closing if null and hide any
SQLExceptions that occur.
public static void closeQuietly(java.sql.ResultSet rs)
ResultSet
, avoid closing if null and hide
any SQLExceptions that occur.
public static void closeQuietly(java.sql.Statement stmt)
Statement
, avoid closing if null and hide
any SQLExceptions that occur.
public static void commitAndClose(java.sql.Connection conn) throws java.sql.SQLException
Connection
then closes it, avoid closing if null.
java.sql.SQLException
public static void commitAndCloseQuietly(java.sql.Connection conn)
Connection
then closes it, avoid closing if null
and hide any SQLExceptions that occur.
public static boolean loadDriver(java.lang.String driverClassName)
public static void printStackTrace(java.sql.SQLException sqle)
public static void printStackTrace(java.sql.SQLException sqle, java.io.PrintWriter pw)
public static void printWarnings(java.sql.Connection connection)
public static void printWarnings(java.sql.Connection conn, java.io.PrintWriter pw)
public static void rollback(java.sql.Connection conn) throws java.sql.SQLException
conn
- The database Connection to rollback. A null value is legal.
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |