© 2005 BEA Systems, Inc.

com.bea.p13n.util.jdbc
Class WlsOracleThinDatabase

java.lang.Object
  extended bycom.bea.p13n.util.jdbc.GenericDatabase
      extended bycom.bea.p13n.util.jdbc.OracleDatabase
          extended bycom.bea.p13n.util.jdbc.WlsOracleThinDatabase
All Implemented Interfaces:
Database

public class WlsOracleThinDatabase
extends OracleDatabase

Concrete implementation of OracleDatabase that provides support for reading/writing of BLOB/CLOB data. Designed to work with Oracle Thin driver when running inside an application server context.

See Also:
OracleDatabase

Constructor Summary
WlsOracleThinDatabase(Connection connection)
           
 
Method Summary
 boolean accept(Connection connection)
          Check to see if the connection URL matches the format defined in "accept.driver.url.regex".
 boolean commitConnection(Connection connection)
           
 byte[] getBlob(ResultSet rs, int index)
          Retrieve Blob value and write to an InputStream from a ResultSet.
 OutputStream getBlobLocator(Connection con, String tableName, String blobColumnName, String whereClause)
          Gets the BlobLocator object inside an Oracle database column.
 String getClob(ResultSet rs, int index)
          Retrieve CLOB value as a String of Unicode characters.
 String getName()
          The name of this GenericDatabase instance.
 void insertClob(ClobKey key, String data)
          Inserts a CLOB into the database managed tables for CLOB persistence
 String readClob(ClobKey key)
          Reads a CLOB into the database managed tables for CLOB persistence
 void removeClob(ClobKey key)
          Removes a CLOB from the database managed tables for CLOB persistence
 void updateClob(ClobKey key, String data)
          Updates a CLOB in the database managed tables for CLOB persistence
 void writeToClob(Clob clob, String data)
          Writes the data from the String into the Clob.
 
Methods inherited from class com.bea.p13n.util.jdbc.OracleDatabase
getClobLocator, getClobLocatorForAdBucket, getEmptyBlobInitializer, getEmptyClobInitializer, setClob, trimClob
 
Methods inherited from class com.bea.p13n.util.jdbc.GenericDatabase
close, close, close, close, close, close, close, close, close, createPreparedStatement, endBlob, endClob, getApplicationName, getClobTableName, getConnection, getProperty, printSqlWarning, readFromClob, readFromClob, setClob, startBlob, startClob, writeToClob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WlsOracleThinDatabase

public WlsOracleThinDatabase(Connection connection)
Method Detail

accept

public boolean accept(Connection connection)
Description copied from class: GenericDatabase
Check to see if the connection URL matches the format defined in "accept.driver.url.regex".

Specified by:
accept in interface Database
Overrides:
accept in class GenericDatabase
Parameters:
connection - The Connection object that contains the URL.
Returns:
true if this Database can bind to the supplied connection. Typically the Database will examine the Connection MetaData to determine suitability.

commitConnection

public boolean commitConnection(Connection connection)
                         throws SQLException
Specified by:
commitConnection in interface Database
Overrides:
commitConnection in class GenericDatabase
Throws:
SQLException

getBlob

public byte[] getBlob(ResultSet rs,
                      int index)
               throws SQLException
Retrieve Blob value and write to an InputStream from a ResultSet.

Specified by:
getBlob in interface Database
Overrides:
getBlob in class GenericDatabase
Parameters:
rs - The ResultSet containing the Blob.
index - The position of the Blob in the ResultSet.
Returns:
An InputStream containing the binary value of the Blob.
Throws:
SQLException - on an error

getBlobLocator

public OutputStream getBlobLocator(Connection con,
                                   String tableName,
                                   String blobColumnName,
                                   String whereClause)
                            throws SQLException
Gets the BlobLocator object inside an Oracle database column.

Specified by:
getBlobLocator in interface Database
Overrides:
getBlobLocator in class GenericDatabase
Returns:
OutputStream An OutputStream pointing to the BlobLocator.
Throws:
SQLException - on an error.

getClob

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

Specified by:
getClob in interface Database
Overrides:
getClob in class GenericDatabase
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.
Throws:
SQLException - on an error
See Also:
getClob(ResultSet rs, int index)

getName

public String getName()
Description copied from class: GenericDatabase
The name of this GenericDatabase instance.

Specified by:
getName in interface Database
Overrides:
getName in class GenericDatabase
Returns:
the name of the database

insertClob

public void insertClob(ClobKey key,
                       String data)
                throws SQLException
Inserts a CLOB into the database managed tables for CLOB persistence

Throws:
SQLException

readClob

public String readClob(ClobKey key)
                throws SQLException
Reads a CLOB into the database managed tables for CLOB persistence

Throws:
SQLException

removeClob

public void removeClob(ClobKey key)
                throws SQLException
Removes a CLOB from the database managed tables for CLOB persistence

Throws:
SQLException

updateClob

public void updateClob(ClobKey key,
                       String data)
                throws SQLException
Updates a CLOB in the database managed tables for CLOB persistence

Overrides:
updateClob in class OracleDatabase
Throws:
SQLException

writeToClob

public void writeToClob(Clob clob,
                        String data)
                 throws SQLException
Writes the data from the String into the Clob.

Specified by:
writeToClob in interface Database
Overrides:
writeToClob in class GenericDatabase
Parameters:
clob - The target Clob object.
data - The data to be converted to a Clob in the form of a String.
Throws:
SQLException - Thrown because this is an unsupported operation.

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved