Object
See also the Database and DatabaseFactory classes.
Object
JdbcHelper
Method Summary |
public static void |
|
public static void | |
public static void | |
public static void |
|
public static void |
|
public static | |
public static |
|
public static |
|
public static |
|
public static |
|
public static | |
public static void |
|
public static void |
|
public static boolean |
|
public static void |
|
public static |
|
public static |
|
public static |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void close(Connection
con)
Close a connection, ignoring any errors.
public static void close(Statement
stmt)
Close a statement, ignoring any errors.
public static void close(ResultSet
rs)
Close a result set, ignoring any errors.
public static void close(Close a connection, statement and resultset, ignoring errors.ResultSet
rs,Statement
stmt,Connection
con)
DEPRECATED in favor of Database.commitConnection()
public static void commitConnection(Commits the java.sql.Connection that you have been using for CLOB operations. A CLOB becomes inactive as soon as a transaction is committed. You must have auto-commit=false on your connection if you need to have a CLOB available across multiple SQL statements.Connection
con)
throwsSQLException
The delegate may implement this as a no-op method if it is illegal to do a Connection.commit() for the driver (e.g., jDriver for Oracle XA)
If there is no delegate, this method does a Connection.commit()
SQLException
DEPRECATED in favor of Database and DatabaseFactory
public staticGet the value of a CLOB column as a string.String
getClob(ResultSet
rs, int index)
throwsSQLException
This method will only return the value of the CLOB in the current row of the ResultSet. This method does not increment the ResultSet cursor. You must use ResultSet.next() to increment the cursor before calling this method. This allows the method to be used to process multi-row ResultSets.
SQLException
DEPRECATED in favor of Database and DatabaseFactory
public staticRetrieve the LOB locator for a CLOB. The method creates a PreparedStatement from the specified parameters and gets the LOB locator from the ResultSet.Clob
getClobLocator(Connection
con,String
tableName,String
clobColumnName,String
whereClause)
throwsSQLException
This method only returns a single CLOB locator. If the WHERE clause results in mutiple rows, only the CLOB from the first row is returned.
If no JdbcHelperDelegate is specified in application-config.xml then this method will return null.
WARNING: if using a delegate to stream data to a CLOB, then you should use Connection.setAutoCommit(false) before calling this method. This will make the CLOB available across multiple SQL statements.
SQLException
DEPRECATED Use DataSource.getConnection(), set retries and waitTime by configuring the Pool
public staticGet a connection from a DataSource.Connection
getConnection(DataSource
src, int retries, long waitTime)
throwsSQLException
This method no longer honors the retry parameter; it will use the 'Connection Reserve Timeout' parameter set on the JdbcConnectionPool via the WLS console settings.
SQLException
DEPRECATED Use DataSource.getConnection(), set retries and waitTime by configuring the Pool
public staticGet a connection from a DataSource.Connection
getConnection(DataSource
src, int retries)
throwsSQLException
This method no longer honors the retry parameter; it will use the 'Connection Reserve Timeout' parameter set on the JdbcConnectionPool cia the WLS console settings.
SQLException
DEPRECATED in favor of Database and DatabaseFactory
public staticReturn the database specific keyword that must be used when inserting a row with an empty CLOB. This method uses the JdbcHelperDelegate. If no JdbcHelperDelegate is specified in application-config.xml then this method will return the empty String.String
getEmptyClobInitializer()
throwsSQLException
For example, the method returns EMPTY_CLOB() when an Oracle delegate is used.
SQLException
public static JdbcHelper
getInstance()
public static void resumeTransaction(Transaction
suspendedTransaction)
Resumes the suspended transaction if it is not null.
DEPRECATED in favor of Database.setClob()
public static void setClob(Set the value of a CLOB column with a string.PreparedStatement
stmt, int index,String
str)
throwsSQLException
SQLException
DEPRECATED in favor of Database.setClob()
public static boolean setClob(If there is a delegate, this method uses JdbcHelperDelegate.writeClobData() If this is done, then the PreparedStatement does not need to be used and the return value, executeRequired, is false. The CLOB should be first located with getClobLocator() If there is no delegate, then this method ignores the Clob argument and sets the value of the String into the CLOB placeholder in the PreparedStatement with setClob(PreparedStatement stmt, int index, String str) and returns executeRequired = true.PreparedStatement
stmt, int index,Clob
clob,String
str)
throwsSQLException
WARNING: if using a delegate to stream data to a CLOB, then you should have used Connection.setAutoCommit(false) before calling the CLOB locator method that provided the Clob you are using in this method call. This will make the CLOB available across multiple SQL statements.
SQLException
Related Topics
JdbcHelperDelegate.writeClobData(PreparedStatement, int, Clob, String)
JdbcHelper.getClobLocator(Connection, String, String, String)
JdbcHelper.setClob(PreparedStatement, int, String)
DEPRECATED in favor of DatabaseFactory
public static void setJdbcHelperDelegate(String
className)
public staticShow transaction isolation level of connectionString
showIsolationLevel(Connection
connection)
throwsSQLException
SQLException
public staticStart a new transactionUserTransaction
startTransaction()
throwsSQLException
SQLException
public static Transaction
suspendTransaction()
Suspend any current transaction (unless suspendTransaction is false).