Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

All Implemented Interfaces
  Database

Direct Known Subclasses:
  OracleDatabase, SetStringDatabase

Deprecated No longer needed

    @Deprecated
    public class GenericDatabase

extends Object
implements Database

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.

See Also
  `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

### GenericDatabase

    public GenericDatabase(Connection connection)

  Deprecated

Method Detail

### accept

    public boolean accept(Connection connection)

  Deprecated
  Check to see if the connection URL matches the format defined in "accept.driver.url.regex".

  Specified by:
    `accept` in interface `Database`
  Parameters
    `connection` - The Connection object that contains the URL.
  Returns
    If this Database can accept a connection URL of the supplied form return true, otherwise return false.

### getConnection

    public Connection getConnection()

  Deprecated
  Return Connection object of the current Database instance.

  Specified by:
    `getConnection` in interface `Database`
  Returns
    The Connection object of the current Database instance.

### close

    public void close()

  Deprecated
  Close the Connection associated with this Database.

  Specified by:
    `close` in interface `Database`

### close

    public void close(Statement stmt)

  Deprecated
  Closes a Statement.

  Specified by:
    `close` in interface `Database`
  Parameters
    `stmt` - The Statement object to be closed.

### close

    public void close(PreparedStatement ps)

  Deprecated
  Closes a PreparedStatement.

  Specified by:
    `close` in interface `Database`
  Parameters
    `ps` - The PreparedStatement object to be closed.

### close

    public void close(ResultSet rs)

  Deprecated
  Close a result set, ignoring any errors.

  Specified by:
    `close` in interface `Database`
  Parameters
    `rs` - The ResultSet object to be closed.

### close

    public void close(ResultSet rs,
                      Statement stmt)

  Deprecated
  Close a statement and resultset, ignoring errors.

  Specified by:
    `close` in interface `Database`
  Parameters
    `rs` - The ResultSet object to be closed.
    `stmt` - The Statement object to be closed.

### readFromClob

    public String readFromClob(Clob clob)
                        throws SQLException

  Deprecated
  Reads the contents of a Clob and returns as a String.

  Specified by:
    `readFromClob` in interface `Database`
  Parameters
    `clob` - The ResultSet object to be closed.
  Returns
    The contents of the Clob as a String.
  Throws
    `SQLException` - Thrown when error occurs while reading Clob.

### readFromClob

    public String readFromClob(ResultSet resultSet,
                               int index)
                        throws SQLException

  Deprecated
  Reads the contents of a Clob and returns as a String.

  Parameters
    `resultSet` - The ResultSet returned from a Statement query.
    `index` - The column index where the Clob can be found in the ResultSet.
  Returns
    The contents of the Clob as a String.
  Throws
    `SQLException` - Thrown when error occurs when reading ResultSet.

### close

    public void close(Reader reader)

  Deprecated
  Closes a Reader.

  Specified by:
    `close` in interface `Database`
  Parameters
    `reader` - The Reader stream.

### close

    public void close(InputStream is)

  Deprecated
  Closes an InputStream.

  Specified by:
    `close` in interface `Database`
  Parameters
    `is` - The InputStream.
  Throws
    `IOException` - Thrown when closing InputStream.

### close

    public void close(Writer writer)

  Deprecated
  Closes a Writer.

  Specified by:
    `close` in interface `Database`
  Parameters
    `writer` - The Writer stream.

### close

    public void close(OutputStream os)

  Deprecated
  Closes an OutputStream.

  Specified by:
    `close` in interface `Database`
  Parameters
    `os` - The OutputStream to close.

### writeToClob

    public void writeToClob(Clob clob,
                            String data)
                     throws SQLException

  Deprecated
  Writes the data from a String into a Clob.

  Specified by:
    `writeToClob` in interface `Database`
  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.

### writeToClob

    public Reader writeToClob(PreparedStatement statement,
                              int index,
                              String data)
                       throws SQLException

  Deprecated
  Writes the data from a String into a Clob using a PreparedStatement.

  Parameters
    `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.
  Throws
    `SQLException` - Thrown when retrieving character stream from statement.

### startClob

    public void startClob()
                   throws SQLException

  Deprecated
  Starts the transaction to commit Clob.

  Specified by:
    `startClob` in interface `Database`
  Throws
    `SQLException` - Thrown when setting auto-commit to false.

### startBlob

    public void startBlob()
                   throws SQLException

  Deprecated
  Starts the transaction to commit Blob.

  Specified by:
    `startBlob` in interface `Database`
  Throws
    `SQLException` - Thrown when setting auto-commit to false.

### endClob

    public void endClob()
                 throws SQLException

  Deprecated
  Commits Clob transaction.

  Specified by:
    `endClob` in interface `Database`
  Throws
    `SQLException` - Thrown when committing Clob.

### endBlob

    public void endBlob()
                 throws SQLException

  Deprecated
  Commits Blob transaction.

  Specified by:
    `endBlob` in interface `Database`
  Throws
    `SQLException` - Thrown when committing Blob.

### getApplicationName

    public String getApplicationName()

  Deprecated
  Get the name of the current WebLogic J2EE application or return null if not running within a WebLogic J2EE context.

  Specified by:
    `getApplicationName` in interface `Database`
  Returns
    The WebLogic J2EE application.

### getClobTableName

    public String getClobTableName()

  Deprecated
  Used to retrieve the name of the table that stores Clobs.

  Returns
    The name of the database table used to persist CLOB datatypes.

### getName

    public String getName()

  Deprecated
  The name of this GenericDatabase instance.

  Specified by:
    `getName` in interface `Database`
  Returns
    String The name of the GenericDatabase instance.

### getProperty

    protected String getProperty(String propertyName)

  Deprecated
  Used to retrieve a property in the ResourceBundle.

  Parameters
    `propertyName` - The name of the property in the ResourceBundle.
  Returns
    The value associated with the property.
  Throws
    `IllegalStateException` - thrown if the property cannot be retrieved.

### printSqlWarning

    protected void printSqlWarning(SQLWarning warning)

  Deprecated
  Prints the SQLWarning to System.err.

  Parameters
    `warning` - The SQLWarning from a Connection, Statement, or ResultSet.

### createPreparedStatement

    protected PreparedStatement createPreparedStatement(String key)
                                                 throws SQLException

  Deprecated
  Creates a PreparedStatement based on queries found in ResourceBundle.

  Parameters
    `key` - The value in ResourceBundle which contains SQL Statement.
  Returns
    A PreparedStatement using the current Connection.
  Throws
    `SQLException`

### getEmptyClobInitializer

    public String getEmptyClobInitializer()
                                   throws SQLException

  Deprecated
  Specified by:
    `getEmptyClobInitializer` in interface `Database`
  Throws
    `SQLException`

### getClobLocator

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

  Deprecated
  Specified by:
    `getClobLocator` in interface `Database`
  Throws
    `SQLException`

### getClob

    public String getClob(ResultSet rs,
                          int index)
                   throws SQLException

  Deprecated
  Description copied from interface: `Database`
  Get the value of a CLOB column as a string.

  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.

  Specified by:
    `getClob` in interface `Database`
  Parameters
    `rs` - the result set.
    `index` - the column index in the result set.
  Returns
    the column as a string.
  Throws
    `SQLException` - thrown on an error.

### setClob

    public void setClob(PreparedStatement stmt,
                        int index,
                        String str)
                 throws SQLException

  Deprecated
  Description copied from interface: `Database`
  Set the value of a CLOB column with a string.

  Specified by:
    `setClob` in interface `Database`
  Parameters
    `stmt` - the prepared statement.
    `index` - the column index.
    `str` - the CLOB string.
  Throws
    `SQLException` - thrown on an error.

### setClob

    public boolean setClob(PreparedStatement stmt,
                           int index,
                           Clob clob,
                           String str)
                    throws SQLException

  Deprecated
  Description copied from interface: `Database`
  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. The CLOB should be first located with getClobLocator() If there is no delegate, then this method ignores the Clob argument and sets the value of the String into the CLOB placeholder in the PreparedStatement with setClob(PreparedStatement stmt, int index, String str) and returns executeRequired = true.

  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.

  Specified by:
    `setClob` in interface `Database`
  Parameters
    `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)
  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` - thrown on an error.

### commitConnection

    public boolean commitConnection(Connection connection)
                             throws SQLException

  Deprecated
  Specified by:
    `commitConnection` in interface `Database`
  Throws
    `SQLException`

### getEmptyBlobInitializer

    public String getEmptyBlobInitializer()
                                   throws SQLException

  Deprecated
  Returns an empty String since Pointbase doesn't use initializers.

  Specified by:
    `getEmptyBlobInitializer` in interface `Database`
  Returns
    String Name of function to initialize a Blob.
  Throws
    `SQLException` - on an error.

### getBlobLocator

    public OutputStream getBlobLocator(Connection con,
                                       String tableName,
                                       String blobColumnName,
                                       String whereClause)
                                throws SQLException

  Deprecated
  Gets an OutputStream to the BlobLocator object. Should be null for Pointbase.

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

### getBlob

    public byte[] getBlob(ResultSet rs,
                          int index)
                   throws SQLException

  Deprecated
  Retrieve Blob value as a byte[] from a ResultSet.

  Specified by:
    `getBlob` in interface `Database`
  Parameters
    `rs` - The ResultSet containing the Blob.
    `index` - The position of the Blob in the ResultSet.
  Returns
    byte[] containing the binary value of the Blob.
  Throws
    `SQLException` - on an error

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.