JdbcHelperDelegate Interface

DEPRECATED

com.bea.p13n.util.jdbc
JdbcHelperDelegate Interface

public interface JdbcHelperDelegate

Interface for the JdbcHelperDelegate, which is used to delegate CLOB read/write operations for specific database drivers.

Method Summary

public void
commitConnection(Connection con)
Commits the java.sql.Connection that you have been using for CLOB operations.
public Clob
getClobLocator(Connection con, String tableName, String clobColumnName, String whereClause)
Retrieve the LOB locator for a CLOB.
public String
getEmptyClobInitializer()
Return the database specific keyword that must be used when inserting a row with an empty CLOB.
public String
readClobData(ResultSet rs, int index)
Retrieve CLOB value as a String of Unicode characters.
public boolean
writeClobData(PreparedStatement stmt, int index, Clob clob, String str)
Write to a CLOB.

Method Detail

commitConnection(Connection) Method

public void commitConnection(Connection con)
throws SQLException
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.

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)

Parameters

con
the Connection

Exceptions

SQLException
on an error

getClobLocator(Connection, String, String, String) Method

public Clob getClobLocator(Connection con, 
                           String tableName, 
                           String clobColumnName, 
                           String whereClause)
throws SQLException
Retrieve the LOB locator for a CLOB. The method creates a PreparedStatement from the specified parameters and gets the LOB locator from the ResultSet.

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.

Parameters

con
the database connection
tableName
the name of the database table
clobColumnName
the name of the column holding the CLOB
whereClause
the where clause (without WHERE keyword)

Returns

a CLOB locator, return null if the ResultSet is empty

Exceptions

SQLException
on an error

getEmptyClobInitializer() Method

public String getEmptyClobInitializer()
throws SQLException
Return the database specific keyword that must be used when inserting a row with an empty CLOB. For example, the method returns EMPTY_CLOB() when the database is Oracle.

Returns

keyword required to insert an empty CLOB, return empty String if not supported

Exceptions

SQLException
on an error

readClobData(ResultSet, int) Method

public String readClobData(ResultSet rs, 
                           int index)
throws SQLException
Retrieve CLOB value as a String of Unicode characters.

Parameters

rs
the resultset containing the clob
index
the position of the clob in the resultset

Returns

the value of the CLOB as a String.

Exceptions

SQLException
on an error

writeClobData(PreparedStatement, int, Clob, String) Method

public boolean writeClobData(PreparedStatement stmt, 
                             int index, 
                             Clob clob, 
                             String str)
throws SQLException
Write to a CLOB. Write the input stream containing the ASCII data associated with the passed String to the CLOB's output stream. Streams support for updating CLOB columns is not addressed by JDBC 2.0 so this method uses an extension implemented in the delegate.

Parameters

stmt
the PreparedStatement
index
the paramater index
clob
the CLOB locator
str
the string value

Returns

boolean executeRequired. If false then a delegate was used to directly set the CLOB in the database without using the PreparedStatement. If true then no delegate was used, or the delegate set the Clob value on the statement and the PreparedStatement must be executed to update the database.

Exceptions

SQLException
on an error