|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.p13n.util.jdbc.JdbcHelper
public class JdbcHelper
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 |
---|
@Deprecated public static JdbcHelper getInstance()
public static String getClobAsString(ResultSet resultSet, int columnIndex) throws SQLException
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.
resultSet
- the result set to readcolumnIndex
- the column to read. First column is 1...
SQLException
- if an error occurspublic static String getClobAsString(ResultSet resultSet, String columnName) throws SQLException
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.
resultSet
- the result set to readcolumnName
- the name of the column to read.
SQLException
- if an error occurspublic static void setClobAsString(PreparedStatement statement, int parameterIndex, String clobData) throws SQLException
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.
statement
- the prepared statementparameterIndex
- the parameter to set. First parameter is 1...clobData
- string to set on the clob
SQLException
- if an error occurspublic static void close(Connection con)
con
- The Connection object to be closed.public static void close(Statement stmt)
stmt
- The Statement object to be closed.public static void close(ResultSet rs)
rs
- The ResultSet object to be closed.public static void close(ResultSet rs, Statement stmt, Connection con)
rs
- The ResultSet object to be closed.stmt
- The Statement object to be closed.con
- The Connection object to be closed.public static SQLException close(Connection connection, ResultSet resultSet, Statement statement, SQLException sqlException)
connection
- resultSet
- statement
- sqlException
- public static String showIsolationLevel(Connection connection) throws SQLException
SQLException
public static UserTransaction startTransaction() throws SQLException
SQLException
public static Transaction suspendTransaction()
public static void resumeTransaction(Transaction suspendedTransaction)
suspendedTransaction
- Transaction to resume.public static Transaction getTransaction()
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |