org.apache.commons.dbutils
クラス DbUtils

java.lang.Object
  上位を拡張 org.apache.commons.dbutils.DbUtils

public final class DbUtils
extends java.lang.Object

A collection of JDBC helper methods. This class is thread safe.


コンストラクタの概要
DbUtils()
           
 
メソッドの概要
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 e)
          Print the stack trace for a SQLException to STDERR.
static void printStackTrace(java.sql.SQLException e, java.io.PrintWriter pw)
          Print the stack trace for a SQLException to a specified PrintWriter.
static void printWarnings(java.sql.Connection conn)
          Print warnings on a Connection to STDERR.
static void printWarnings(java.sql.Connection conn, java.io.PrintWriter pw)
          Print warnings on a Connection to a specified PrintWriter.
static void rollback(java.sql.Connection conn)
          Rollback any changes made on the given connection.
static void rollbackAndClose(java.sql.Connection conn)
          Performs a rollback on the Connection then closes it, avoid closing if null.
static void rollbackAndCloseQuietly(java.sql.Connection conn)
          Performs a rollback on the Connection then closes it, avoid closing if null and hide any SQLExceptions that occur.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

DbUtils

public DbUtils()
メソッドの詳細

close

public static void close(java.sql.Connection conn)
                  throws java.sql.SQLException
Close a Connection, avoid closing if null.

パラメータ:
conn - Connection to close.
例外:
java.sql.SQLException - if a database access error occurs

close

public static void close(java.sql.ResultSet rs)
                  throws java.sql.SQLException
Close a ResultSet, avoid closing if null.

パラメータ:
rs - ResultSet to close.
例外:
java.sql.SQLException - if a database access error occurs

close

public static void close(java.sql.Statement stmt)
                  throws java.sql.SQLException
Close a Statement, avoid closing if null.

パラメータ:
stmt - Statement to close.
例外:
java.sql.SQLException - if a database access error occurs

closeQuietly

public static void closeQuietly(java.sql.Connection conn)
Close a Connection, avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
conn - Connection to close.

closeQuietly

public static void closeQuietly(java.sql.Connection conn,
                                java.sql.Statement stmt,
                                java.sql.ResultSet rs)
Close a Connection, Statement and ResultSet. Avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
conn - Connection to close.
stmt - Statement to close.
rs - ResultSet to close.

closeQuietly

public static void closeQuietly(java.sql.ResultSet rs)
Close a ResultSet, avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
rs - ResultSet to close.

closeQuietly

public static void closeQuietly(java.sql.Statement stmt)
Close a Statement, avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
stmt - Statement to close.

commitAndClose

public static void commitAndClose(java.sql.Connection conn)
                           throws java.sql.SQLException
Commits a Connection then closes it, avoid closing if null.

パラメータ:
conn - Connection to close.
例外:
java.sql.SQLException - if a database access error occurs

commitAndCloseQuietly

public static void commitAndCloseQuietly(java.sql.Connection conn)
Commits a Connection then closes it, avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
conn - Connection to close.

loadDriver

public static boolean loadDriver(java.lang.String driverClassName)
Loads and registers a database driver class. If this succeeds, it returns true, else it returns false.

パラメータ:
driverClassName - of driver to load
戻り値:
boolean true if the driver was found, otherwise false

printStackTrace

public static void printStackTrace(java.sql.SQLException e)
Print the stack trace for a SQLException to STDERR.

パラメータ:
e - SQLException to print stack trace of

printStackTrace

public static void printStackTrace(java.sql.SQLException e,
                                   java.io.PrintWriter pw)
Print the stack trace for a SQLException to a specified PrintWriter.

パラメータ:
e - SQLException to print stack trace of
pw - PrintWriter to print to

printWarnings

public static void printWarnings(java.sql.Connection conn)
Print warnings on a Connection to STDERR.

パラメータ:
conn - Connection to print warnings from

printWarnings

public static void printWarnings(java.sql.Connection conn,
                                 java.io.PrintWriter pw)
Print warnings on a Connection to a specified PrintWriter.

パラメータ:
conn - Connection to print warnings from
pw - PrintWriter to print to

rollback

public static void rollback(java.sql.Connection conn)
                     throws java.sql.SQLException
Rollback any changes made on the given connection.

パラメータ:
conn - Connection to rollback. A null value is legal.
例外:
java.sql.SQLException - if a database access error occurs

rollbackAndClose

public static void rollbackAndClose(java.sql.Connection conn)
                             throws java.sql.SQLException
Performs a rollback on the Connection then closes it, avoid closing if null.

パラメータ:
conn - Connection to rollback. A null value is legal.
例外:
java.sql.SQLException - if a database access error occurs
導入されたバージョン:
DbUtils 1.1

rollbackAndCloseQuietly

public static void rollbackAndCloseQuietly(java.sql.Connection conn)
Performs a rollback on the Connection then closes it, avoid closing if null and hide any SQLExceptions that occur.

パラメータ:
conn - Connection to rollback. A null value is legal.
導入されたバージョン:
DbUtils 1.1