| java.lang.Object org.apache.commons.dbutils.DbUtils
DbUtils | final public class DbUtils (Code) | | A collection of JDBC helper methods. This class is thread safe.
|
Method Summary | |
public static void | close(Connection conn) Close a Connection , avoid closing if null. | public static void | close(ResultSet rs) Close a ResultSet , avoid closing if null. | public static void | close(Statement stmt) Close a Statement , avoid closing if null. | public static void | closeQuietly(Connection conn) Close a Connection , avoid closing if null and hide
any SQLExceptions that occur. | public static void | closeQuietly(Connection conn, Statement stmt, ResultSet rs) Close a Connection , Statement and
ResultSet . | public static void | closeQuietly(ResultSet rs) Close a ResultSet , avoid closing if null and hide any
SQLExceptions that occur. | public static void | closeQuietly(Statement stmt) Close a Statement , avoid closing if null and hide
any SQLExceptions that occur. | public static void | commitAndClose(Connection conn) Commits a Connection then closes it, avoid closing if null. | public static void | commitAndCloseQuietly(Connection conn) Commits a Connection then closes it, avoid closing if null
and hide any SQLExceptions that occur. | public static boolean | loadDriver(String driverClassName) Loads and registers a database driver class. | public static void | printStackTrace(SQLException e) Print the stack trace for a SQLException to STDERR. | public static void | printStackTrace(SQLException e, PrintWriter pw) Print the stack trace for a SQLException to a
specified PrintWriter. | public static void | printWarnings(Connection conn) Print warnings on a Connection to STDERR. | public static void | printWarnings(Connection conn, PrintWriter pw) Print warnings on a Connection to a specified PrintWriter. | public static void | rollback(Connection conn) Rollback any changes made on the given connection.
Parameters: conn - Connection to rollback. | public static void | rollbackAndClose(Connection conn) Performs a rollback on the Connection then closes it,
avoid closing if null.
Parameters: conn - Connection to rollback. | public static void | rollbackAndCloseQuietly(Connection conn) Performs a rollback on the Connection then closes it,
avoid closing if null and hide any SQLExceptions that occur.
Parameters: conn - Connection to rollback. |
close | public static void close(Connection conn) throws SQLException(Code) | | Close a Connection , avoid closing if null.
Parameters: conn - Connection to close. throws: SQLException - if a database access error occurs |
close | public static void close(ResultSet rs) throws SQLException(Code) | | Close a ResultSet , avoid closing if null.
Parameters: rs - ResultSet to close. throws: SQLException - if a database access error occurs |
close | public static void close(Statement stmt) throws SQLException(Code) | | Close a Statement , avoid closing if null.
Parameters: stmt - Statement to close. throws: SQLException - if a database access error occurs |
closeQuietly | public static void closeQuietly(Connection conn)(Code) | | Close a Connection , avoid closing if null and hide
any SQLExceptions that occur.
Parameters: conn - Connection to close. |
closeQuietly | public static void closeQuietly(Connection conn, Statement stmt, ResultSet rs)(Code) | | Close a Connection , Statement and
ResultSet . Avoid closing if null and hide any
SQLExceptions that occur.
Parameters: conn - Connection to close. Parameters: stmt - Statement to close. Parameters: rs - ResultSet to close. |
closeQuietly | public static void closeQuietly(ResultSet rs)(Code) | | Close a ResultSet , avoid closing if null and hide any
SQLExceptions that occur.
Parameters: rs - ResultSet to close. |
closeQuietly | public static void closeQuietly(Statement stmt)(Code) | | Close a Statement , avoid closing if null and hide
any SQLExceptions that occur.
Parameters: stmt - Statement to close. |
commitAndClose | public static void commitAndClose(Connection conn) throws SQLException(Code) | | Commits a Connection then closes it, avoid closing if null.
Parameters: conn - Connection to close. throws: SQLException - if a database access error occurs |
commitAndCloseQuietly | public static void commitAndCloseQuietly(Connection conn)(Code) | | Commits a Connection then closes it, avoid closing if null
and hide any SQLExceptions that occur.
Parameters: conn - Connection to close. |
loadDriver | public static boolean loadDriver(String driverClassName)(Code) | | Loads and registers a database driver class.
If this succeeds, it returns true, else it returns false.
Parameters: driverClassName - of driver to load boolean true if the driver was found, otherwise false |
printStackTrace | public static void printStackTrace(SQLException e)(Code) | | Print the stack trace for a SQLException to STDERR.
Parameters: e - SQLException to print stack trace of |
printStackTrace | public static void printStackTrace(SQLException e, PrintWriter pw)(Code) | | Print the stack trace for a SQLException to a
specified PrintWriter.
Parameters: e - SQLException to print stack trace of Parameters: pw - PrintWriter to print to |
printWarnings | public static void printWarnings(Connection conn)(Code) | | Print warnings on a Connection to STDERR.
Parameters: conn - Connection to print warnings from |
printWarnings | public static void printWarnings(Connection conn, PrintWriter pw)(Code) | | Print warnings on a Connection to a specified PrintWriter.
Parameters: conn - Connection to print warnings from Parameters: pw - PrintWriter to print to |
rollback | public static void rollback(Connection conn) throws SQLException(Code) | | Rollback any changes made on the given connection.
Parameters: conn - Connection to rollback. A null value is legal. throws: SQLException - if a database access error occurs |
rollbackAndClose | public static void rollbackAndClose(Connection conn) throws SQLException(Code) | | Performs a rollback on the Connection then closes it,
avoid closing if null.
Parameters: conn - Connection to rollback. A null value is legal. throws: SQLException - if a database access error occurs since: DbUtils 1.1 |
rollbackAndCloseQuietly | public static void rollbackAndCloseQuietly(Connection conn)(Code) | | Performs a rollback on the Connection then closes it,
avoid closing if null and hide any SQLExceptions that occur.
Parameters: conn - Connection to rollback. A null value is legal. since: DbUtils 1.1 |
|
|