Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.util.jdbc
Class OracleDatabase

    java.lang.Object
      com.bea.p13n.util.jdbc.GenericDatabase
          com.bea.p13n.util.jdbc.OracleDatabase

All Implemented Interfaces:
  Database

Direct Known Subclasses:
  OracleThinDatabase, WlsOracleJDriverDatabase, WlsOracleThinDatabase

public abstract class OracleDatabase
extends GenericDatabase

Provides partial implementation of common functionality for Oracle JDBC drivers. Base class for Oracle driver-specific Database instances to support reading/writing of BLOB/CLOB data.

See Also:
  `GenericDatabase`

Constructor Summary
`OracleDatabase(Connection connection)`

Method Summary
`Clob` | `getClobLocator(Connection con, String tableName, String clobColumnName, String whereClause)`
`String` | `getEmptyBlobInitializer()` Returns the String required to initialize a BlobLocator object in an Oracle database.
`String` | `getEmptyClobInitializer()`
`boolean` | `setClob(PreparedStatement stmt, int index, Clob clob, String data)` Write to a CLOB.
`protected void` | `trimClob(Clob clob, long newLength)` Trim a CLOB to desired size.
`void` | `updateClob(ClobKey key, String data)` Updates a CLOB in the database managed tables for CLOB persistence

Methods inherited from class com.bea.p13n.util.jdbc.GenericDatabase
`accept, close, close, close, close, close, close, close, close, close, commitConnection, createPreparedStatement, endBlob, endClob, getApplicationName, getBlob, getBlobLocator, getClob, getClobTableName, getConnection, getName, getProperty, printSqlWarning, readFromClob, readFromClob, setClob, startBlob, startClob, writeToClob, writeToClob`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OracleDatabase

    public OracleDatabase(Connection connection)

Method Detail

### getClobLocator

    public Clob getClobLocator(Connection con,
                               String tableName,
                               String clobColumnName,
                               String whereClause)
                        throws SQLException

  Specified by:
    `getClobLocator` in interface `Database`
  Overrides:
    `getClobLocator` in class `GenericDatabase`
  Throws:
    `SQLException`

### getEmptyBlobInitializer

    public String getEmptyBlobInitializer()
                                   throws SQLException

  Returns the String required to initialize a BlobLocator object in an Oracle database. Since you modify the BlobLocator object in the database instead of writing to the column directly, this helps to identify the method used to create one in a PreparedStatement such as INSERT INTO BLOB_TABLE ( ID, BLOBS ) VALUES ( ?, empty_blob() ).

  Specified by:
    `getEmptyBlobInitializer` in interface `Database`
  Overrides:
    `getEmptyBlobInitializer` in class `GenericDatabase`
  Returns:
    String method used to create a BlobLocator in an Oracle database.
  Throws:
    `SQLException` - on an error.

### getEmptyClobInitializer

    public String getEmptyClobInitializer()
                                   throws SQLException

  Specified by:
    `getEmptyClobInitializer` in interface `Database`
  Overrides:
    `getEmptyClobInitializer` in class `GenericDatabase`
  Throws:
    `SQLException`

### setClob

    public boolean setClob(PreparedStatement stmt,
                           int index,
                           Clob clob,
                           String data)
                    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. This will always return false, since the Clob is written directly to the database.

  Specified by:
    `setClob` in interface `Database`
  Overrides:
    `setClob` in class `GenericDatabase`
  Parameters:
    `stmt` - the PreparedStatement
    `index` - the paramater index
    `clob` - the CLOB locator
  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.
  Throws:
    `SQLException` - on an error

### trimClob

    protected void trimClob(Clob clob,
                            long newLength)
                     throws SQLException

  Trim a CLOB to desired size. This method does not commit the connection. In normal use, you will call this method with a connection that has auto-commit disabled. After you have called this method with such a connection you can then commit it (if you are finished with the CLOB).

  If the newLength is greater than or equal to the current CLOB length (determined from Clob.length()) then nothing is done.

  This trim is required because Oracle has some strange behavior for CLOB UPDATEs:

  If you use UPDATE to put a small CLOB into a field that contains a larger CLOB, then the CLOB size remains unchanged. In other words, the new small CLOB data overlaps the large CLOB data and the end of the CLOB consists of the old data from the end of the large CLOB.

  Throws:
    `SQLException`

### updateClob

    public void updateClob(ClobKey key,
                           String data)
                    throws SQLException

  Updates a CLOB in the database managed tables for CLOB persistence

  Throws:
    `SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved