|
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 |
java.lang.Object com.bea.p13n.util.jdbc.GenericDatabase
@Deprecated public class GenericDatabase
Concrete implementation of the Database interface. This implementation is designed to be used with database drivers that support Statement.setCharacterStream() and Statement.setBinaryStream(). Drivers also need to support Clob.getCharacterStream() to write/read CLOBs and Blob.getBinaryStream() to write/read BLOBs.
The setClob, getClob, setBlob, and getBlob methods in this class should be overidden if a driver does not support the above methods when working with BLOBs and CLOBs.
Database
Constructor Summary | |
---|---|
GenericDatabase(Connection connection)
Deprecated |
Method Summary | |
---|---|
boolean |
accept(Connection connection)
Deprecated Check to see if the connection URL matches the format defined in "accept.driver.url.regex". |
void |
close()
Deprecated Close the Connection associated with this Database. |
void |
close(InputStream is)
Deprecated Closes an InputStream. |
void |
close(OutputStream os)
Deprecated Closes an OutputStream. |
void |
close(PreparedStatement ps)
Deprecated Closes a PreparedStatement. |
void |
close(Reader reader)
Deprecated Closes a Reader. |
void |
close(ResultSet rs)
Deprecated Close a result set, ignoring any errors. |
void |
close(ResultSet rs,
Statement stmt)
Deprecated Close a statement and resultset, ignoring errors. |
void |
close(Statement stmt)
Deprecated Closes a Statement. |
void |
close(Writer writer)
Deprecated Closes a Writer. |
boolean |
commitConnection(Connection connection)
Deprecated |
protected PreparedStatement |
createPreparedStatement(String key)
Deprecated Creates a PreparedStatement based on queries found in ResourceBundle. |
void |
endBlob()
Deprecated Commits Blob transaction. |
void |
endClob()
Deprecated Commits Clob transaction. |
String |
getApplicationName()
Deprecated Get the name of the current WebLogic J2EE application or return null if not running within a WebLogic J2EE context. |
byte[] |
getBlob(ResultSet rs,
int index)
Deprecated Retrieve Blob value as a byte[] from a ResultSet. |
OutputStream |
getBlobLocator(Connection con,
String tableName,
String blobColumnName,
String whereClause)
Deprecated Gets an OutputStream to the BlobLocator object. |
String |
getClob(ResultSet rs,
int index)
Deprecated Get the value of a CLOB column as a string. |
Clob |
getClobLocator(Connection con,
String tableName,
String clobColumnName,
String whereClause)
Deprecated |
String |
getClobTableName()
Deprecated Used to retrieve the name of the table that stores Clobs. |
Connection |
getConnection()
Deprecated Return Connection object of the current Database instance. |
String |
getEmptyBlobInitializer()
Deprecated Returns an empty String since Pointbase doesn't use initializers. |
String |
getEmptyClobInitializer()
Deprecated |
String |
getName()
Deprecated The name of this GenericDatabase instance. |
protected String |
getProperty(String propertyName)
Deprecated Used to retrieve a property in the ResourceBundle. |
protected void |
printSqlWarning(SQLWarning warning)
Deprecated Prints the SQLWarning to System.err. |
String |
readFromClob(Clob clob)
Deprecated Reads the contents of a Clob and returns as a String. |
String |
readFromClob(ResultSet resultSet,
int index)
Deprecated Reads the contents of a Clob and returns as a String. |
boolean |
setClob(PreparedStatement stmt,
int index,
Clob clob,
String str)
Deprecated 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. |
void |
setClob(PreparedStatement stmt,
int index,
String str)
Deprecated Set the value of a CLOB column with a string. |
void |
startBlob()
Deprecated Starts the transaction to commit Blob. |
void |
startClob()
Deprecated Starts the transaction to commit Clob. |
void |
writeToClob(Clob clob,
String data)
Deprecated Writes the data from a String into a Clob. |
Reader |
writeToClob(PreparedStatement statement,
int index,
String data)
Deprecated Writes the data from a String into a Clob using a PreparedStatement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericDatabase(Connection connection)
Method Detail |
---|
public boolean accept(Connection connection)
accept
in interface Database
connection
- The Connection object that contains the URL.
public Connection getConnection()
getConnection
in interface Database
public void close()
close
in interface Database
public void close(Statement stmt)
close
in interface Database
stmt
- The Statement object to be closed.public void close(PreparedStatement ps)
close
in interface Database
ps
- The PreparedStatement object to be closed.public void close(ResultSet rs)
close
in interface Database
rs
- The ResultSet object to be closed.public void close(ResultSet rs, Statement stmt)
close
in interface Database
rs
- The ResultSet object to be closed.stmt
- The Statement object to be closed.public String readFromClob(Clob clob) throws SQLException
readFromClob
in interface Database
clob
- The ResultSet object to be closed.
SQLException
- Thrown when error occurs while reading Clob.public String readFromClob(ResultSet resultSet, int index) throws SQLException
resultSet
- The ResultSet returned from a Statement
query.index
- The column index where the Clob can be found in
the ResultSet.
SQLException
- Thrown when error occurs when reading ResultSet.public void close(Reader reader)
close
in interface Database
reader
- The Reader stream.public void close(InputStream is)
close
in interface Database
is
- The InputStream.
IOException
- Thrown when closing InputStream.public void close(Writer writer)
close
in interface Database
writer
- The Writer stream.public void close(OutputStream os)
close
in interface Database
os
- The OutputStream to close.public void writeToClob(Clob clob, String data) throws SQLException
writeToClob
in interface Database
clob
- The target Clob object.data
- The data to be converted to a Clob in the form of a String.
SQLException
- Thrown because this is an unsupported operation.public Reader writeToClob(PreparedStatement statement, int index, String data) throws SQLException
stmt
- The PreparedStatement that holds the query.index
- The index in the PreparedStatement that holds the Clob.data
- The data to be converted to be written as a Clob.
SQLException
- Thrown when retrieving character stream from statement.public void startClob() throws SQLException
startClob
in interface Database
SQLException
- Thrown when setting auto-commit to false.public void startBlob() throws SQLException
startBlob
in interface Database
SQLException
- Thrown when setting auto-commit to false.public void endClob() throws SQLException
endClob
in interface Database
SQLException
- Thrown when committing Clob.public void endBlob() throws SQLException
endBlob
in interface Database
SQLException
- Thrown when committing Blob.public String getApplicationName()
getApplicationName
in interface Database
public String getClobTableName()
public String getName()
getName
in interface Database
protected String getProperty(String propertyName)
propertyName
- The name of the property in the ResourceBundle.
IllegalStateException
- thrown if the property cannot be retrieved.protected void printSqlWarning(SQLWarning warning)
warning
- The SQLWarning from a Connection, Statement, or ResultSet.protected PreparedStatement createPreparedStatement(String key) throws SQLException
key
- The value in ResourceBundle which contains SQL Statement.
SQLException
public String getEmptyClobInitializer() throws SQLException
getEmptyClobInitializer
in interface Database
SQLException
public Clob getClobLocator(Connection con, String tableName, String clobColumnName, String whereClause) throws SQLException
getClobLocator
in interface Database
SQLException
public String getClob(ResultSet rs, int index) throws SQLException
Database
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.
getClob
in interface Database
rs
- the result set.index
- the column index in the result set.
SQLException
- thrown on an error.public void setClob(PreparedStatement stmt, int index, String str) throws SQLException
Database
setClob
in interface Database
stmt
- the prepared statement.index
- the column index.str
- the CLOB string.
SQLException
- thrown on an error.public boolean setClob(PreparedStatement stmt, int index, Clob clob, String str) throws SQLException
Database
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.
setClob
in interface Database
stmt
- the prepared statement.index
- the column index.clob
- the CLOB locator (ignored if no delegate).str
- the String to be set in the CLOB (if delegate) or in the PreparedStatement (if no delegate)
SQLException
- thrown on an error.public boolean commitConnection(Connection connection) throws SQLException
commitConnection
in interface Database
SQLException
public String getEmptyBlobInitializer() throws SQLException
getEmptyBlobInitializer
in interface Database
SQLException
- on an error.public OutputStream getBlobLocator(Connection con, String tableName, String blobColumnName, String whereClause) throws SQLException
getBlobLocator
in interface Database
SQLException
- on an error.public byte[] getBlob(ResultSet rs, int index) throws SQLException
getBlob
in interface Database
rs
- The ResultSet containing the Blob.index
- The position of the Blob in the ResultSet.
SQLException
- on an error
|
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 |