Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.util.jdbc
Class JdbcHelper

    java.lang.Object
      com.bea.p13n.util.jdbc.JdbcHelper

    public class JdbcHelper

extends Object

This class contains helper methods for jdbc resources.

Method Summary
`static void` | `close(Connection con)` Close a connection, ignoring any errors.
`static SQLException` | `close(Connection connection, ResultSet resultSet, Statement statement, SQLException sqlException)` Used to preserve first occuring instance of a SQLException, so it may be rethrown after cleanup
`static void` | `close(ResultSet rs)` Close a result set, ignoring any errors.
`static void` | `close(ResultSet rs, Statement stmt, Connection con)` Close a connection, statement and resultset, ignoring errors.
`static void` | `close(Statement stmt)` Close a statement, ignoring any errors.
`static String` | `getClobAsString(ResultSet resultSet, int columnIndex)` Convenience method to read a String from a clob.
`static String` | `getClobAsString(ResultSet resultSet, String columnName)` Convenience method to read a String from a clob.
`static JdbcHelper` | `getInstance()` Deprecated since there are no instance methods remaining on this class
`static Transaction` | `getTransaction()` Returns the transaction
`static void` | `resumeTransaction(Transaction suspendedTransaction)` Resumes the suspended transaction if it is not null.
`static void` | `setClobAsString(PreparedStatement statement, int parameterIndex, String clobData)` Convenience method to set a clob field from a String.
`static String` | `showIsolationLevel(Connection connection)` Show transaction isolation level of connection
`static UserTransaction` | `startTransaction()` Start a new transaction
`static Transaction` | `suspendTransaction()` Suspend any current transaction (unless suspendTransaction is false).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    @Deprecated
    public static JdbcHelper getInstance()

  Deprecated since there are no instance methods remaining on this class

### getClobAsString

    public static String getClobAsString(ResultSet resultSet,
                                         int columnIndex)
                                  throws SQLException

  Convenience method to read a String from a clob. This method retrieves a Reader from `ResultSet.getCharacterStream(int)` and reads that data into a String. It may be safe in many cases to simply call `ResultSet.getString(int)`, however that may not work consistently across all drivers, especially with larger strings.

  Parameters
    `resultSet` - the result set to read
    `columnIndex` - the column to read. First column is 1...
  Returns
    a String containing the clob data
  Throws
    `SQLException` - if an error occurs

### getClobAsString

    public static String getClobAsString(ResultSet resultSet,
                                         String columnName)
                                  throws SQLException

  Convenience method to read a String from a clob. This method retrieves a Reader from `ResultSet.getCharacterStream(String)` and reads that data into a String. It may be safe in many cases to simply call `ResultSet.getString(int)`, however that may not work consistently across all drivers, especially with larger strings.

  Parameters
    `resultSet` - the result set to read
    `columnName` - the name of the column to read.
  Returns
    a String containing the clob data
  Throws
    `SQLException` - if an error occurs

### setClobAsString

    public static void setClobAsString(PreparedStatement statement,
                                       int parameterIndex,
                                       String clobData)
                                throws SQLException

  Convenience method to set a clob field from a String. This method creates a StringReader arounc clobData and calls `PreparedStatement.setCharacterStream(int, java.io.Reader, int)` It may be safe in many cases to simply call `PreparedStatement.setString(int,String)`, however that may not work consistently across all drivers, especially with larger strings.

  Parameters
    `statement` - the prepared statement
    `parameterIndex` - the parameter to set. First parameter is 1...
    `clobData` - string to set on the clob
  Throws
    `SQLException` - if an error occurs

### close

    public static void close(Connection con)

  Close a connection, ignoring any errors.

  Parameters
    `con` - The Connection object to be closed.

### close

    public static void close(Statement stmt)

  Close a statement, ignoring any errors.

  Parameters
    `stmt` - The Statement object to be closed.

### close

    public static void close(ResultSet rs)

  Close a result set, ignoring any errors.

  Parameters
    `rs` - The ResultSet object to be closed.

### close

    public static void close(ResultSet rs,
                             Statement stmt,
                             Connection con)

  Close a connection, statement and resultset, ignoring errors.

  Parameters
    `rs` - The ResultSet object to be closed.
    `stmt` - The Statement object to be closed.
    `con` - The Connection object to be closed.

### close

    public static SQLException close(Connection connection,
                                     ResultSet resultSet,
                                     Statement statement,
                                     SQLException sqlException)

  Used to preserve first occuring instance of a SQLException, so it may be rethrown after cleanup

  Parameters
    `connection` -
    `resultSet` -
    `statement` -
    `sqlException` -

### showIsolationLevel

    public static String showIsolationLevel(Connection connection)
                                     throws SQLException

  Show transaction isolation level of connection

  Throws
    `SQLException`

### startTransaction

    public static UserTransaction startTransaction()
                                            throws SQLException

  Start a new transaction

  Throws
    `SQLException`

### suspendTransaction

    public static Transaction suspendTransaction()

  Suspend any current transaction (unless suspendTransaction is false).

  Returns
    the suspended transaction (or null if none)

### resumeTransaction

    public static void resumeTransaction(Transaction suspendedTransaction)

  Resumes the suspended transaction if it is not null.

  Parameters
    `suspendedTransaction` - Transaction to resume.

### getTransaction

    public static Transaction getTransaction()

  Returns the transaction

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.