© 2005 BEA Systems, Inc.

com.bea.p13n.util.jdbc
Class OracleThinDatabase

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

public class OracleThinDatabase
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 outside an application server context.

See Also:
OracleDatabase

Constructor Summary
OracleThinDatabase(Connection connection)
           
 
Method Summary
 boolean accept(Connection connection)
          Check to see if the connection URL matches the format defined in "accept.driver.url.regex".
 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 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, updateClob
 
Methods inherited from class com.bea.p13n.util.jdbc.GenericDatabase
close, close, close, close, close, close, close, close, close, commitConnection, 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

OracleThinDatabase

public OracleThinDatabase(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.

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

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