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

## oracle.ifs.share.sql
Class ConnectionWrapper

    java.lang.Object
      oracle.ifs.share.sql.ConnectionWrapper

Direct Known Subclasses:
  IfsConnection

    public class ConnectionWrapper

extends java.lang.Object

An ConnectionWrapper represents a session with a specific database. Within the context of an ConnectionWrapper, SQL statements are executed and results are returned.

(Published)

Constructor Summary
`ConnectionWrapper()` Constructs a ConnectionWrapper.
`ConnectionWrapper(java.sql.Connection conn)` Constructs a ConnectionWrapper.

Method Summary
`void` | `clearWarnings()` After this call, getWarnings returns null until a new warning is reported for this ConnectionWrapper.
`void` | `commit()` Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the ConnectionWrapper.
`protected CallableStatementWrapper` | `constructCallableStatementWrapper(java.sql.CallableStatement cstmt)` Constructs a CallableStatementWrapper.
`protected PreparedStatementWrapper` | `constructPreparedStatementWrapper(java.sql.PreparedStatement pstmt)` Constructs a PreparedStatementWrapper.
`protected StatementWrapper` | `constructStatementWrapper(java.sql.Statement stmt)` Constructs a StatementWrapper.
`StatementWrapper` | `createStatement()` Create a statement.
`void` | `dispose()` Dispose the ConnectionWrapper and any IfsStatement objects.
`boolean` | `execute(java.sql.PreparedStatement pstmt)` Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.
`boolean` | `execute(java.sql.Statement stmt, java.lang.String sql)` Execute a SQL statement that may return multiple results.
`int[]` | `executeBatch(java.sql.Statement stmt)` Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
`java.sql.ResultSet` | `executeQuery(java.sql.PreparedStatement pstmt)` A prepared SQL query is executed and its ResultSet is returned.
`java.sql.ResultSet` | `executeQuery(java.sql.Statement stmt, java.lang.String sql)` Execute a SQL statement that returns a single ResultSet.
`int` | `executeUpdate(java.sql.PreparedStatement pstmt)` Execute a SQL INSERT, UPDATE or DELETE statement.
`int` | `executeUpdate(java.sql.Statement stmt, java.lang.String sql)` Execute a SQL INSERT, UPDATE or DELETE statement.
`boolean` | `getAutoCommit()` Get the current auto-commit state.
`java.lang.String` | `getCatalog()` Return the ConnectionWrapper's current catalog name.
`java.sql.DatabaseMetaData` | `getMetaData()` An ConnectionWrapper's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.
`int` | `getTransactionIsolation()` Get this ConnectionWrapper's current transaction isolation mode.
`java.sql.SQLWarning` | `getWarnings()` The first warning reported by calls on this ConnectionWrapper is returned.
`protected void` | `initialize(java.sql.Connection conn)` Initializes a ConnectionWrapper.
`boolean` | `isClosed()` Tests to see if an ConnectionWrapper is closed.
`boolean` | `isReadOnly()` Tests to see if the connection is in read-only mode.
`java.lang.String` | `nativeSQL(java.lang.String sql)` A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.
`CallableStatementWrapper` | `prepareCall(java.lang.String sql)` Create a callable statement, used for stored procedures.
`PreparedStatementWrapper` | `prepareStatement(java.lang.String sql)` Create a prepared statement.
`void` | `rollback()` Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the ConnectionWrapper.
`void` | `setAutoCommit(boolean autoCommit)` If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.
`void` | `setCatalog(java.lang.String catalog)` A sub-space of this ConnectionWrapper's database may be selected by setting a catalog name.
`void` | `setReadOnly(boolean readOnly)` You can put a connection in read-only mode as a hint to enable database optimizations.
`void` | `setTransactionIsolation(int level)` You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.

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

Constructor Detail

### ConnectionWrapper

    public ConnectionWrapper()

  Constructs a ConnectionWrapper.

  (Unpublished)

### ConnectionWrapper

    public ConnectionWrapper(java.sql.Connection conn)

  Constructs a ConnectionWrapper.

  Parameters:
    `conn` - JDBC connection
  (Published)

Method Detail

### initialize

    protected void initialize(java.sql.Connection conn)

  Description copied from class: `ConnectionWrapper`
  Initializes a ConnectionWrapper.

  Parameters:
    `conn` - JDBC connection
  (Unpublished)

### createStatement

    public StatementWrapper createStatement()
                                     throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Create a statement.

  SQL statements without parameters are normally executed using StatementWrapper objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatementWrapper.

  Returns:
    a new StatementWrapper object
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### prepareStatement

    public PreparedStatementWrapper prepareStatement(java.lang.String sql)
                                              throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Create a prepared statement.

  A SQL statement with or without IN parameters can be pre-compiled and stored in an IfsPreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

  Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, this method will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the IfsPreparedStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

  Parameters:
    `sql` - a SQL statement that may contain one or more '?' IN parameter placeholders
  Returns:
    a new IfsPreparedStatement object containing the pre-compiled statement
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### prepareCall

    public CallableStatementWrapper prepareCall(java.lang.String sql)
                                         throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Create a callable statement, used for stored procedures.

  A SQL stored procedure call statement is handled by creating a IfsCallableStatement for it. The IfsCallableStatement provides methods for setting up its IN and OUT parameters, and methods for executing it.

  Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the prepareCall is done; others may wait until the IfsCallableStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions.

  Parameters:
    `sql` - a SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is a JDBC function call escape string.
  Returns:
    a new IfsCallableStatement object containing the pre-compiled SQL statement
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### constructStatementWrapper

    protected StatementWrapper constructStatementWrapper(java.sql.Statement stmt)

  Description copied from class: `ConnectionWrapper`
  Constructs a StatementWrapper.

  This can be overridden to construct a subclass of StatementWrapper.

  Parameters:
    `stmt` - the Statement to wrap
  Returns:
    a new StatementWrapper
  (Unpublished)

### constructPreparedStatementWrapper

    protected PreparedStatementWrapper constructPreparedStatementWrapper(java.sql.PreparedStatement pstmt)

  Description copied from class: `ConnectionWrapper`
  Constructs a PreparedStatementWrapper.

  This can be overridden to construct a subclass of PreparedStatementWrapper.

  Parameters:
    `pstmt` - the PreparedStatement to wrap
  Returns:
    a new PreparedStatementWrapper
  (Unpublished)

### constructCallableStatementWrapper

    protected CallableStatementWrapper constructCallableStatementWrapper(java.sql.CallableStatement cstmt)

  Description copied from class: `ConnectionWrapper`
  Constructs a CallableStatementWrapper.

  This can be overridden to construct a subclass of CallableStatement.

  Parameters:
    `cstmt` - the CallableStatement to wrap
  Returns:
    a new CallableStatementWrapper
  (Unpublished)

### executeQuery

    public java.sql.ResultSet executeQuery(java.sql.Statement stmt,
                                           java.lang.String sql)
                                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Execute a SQL statement that returns a single ResultSet.

  Parameters:
    `stmt` - the Statement
    `sql` - typically this is a static SQL SELECT statement
  Returns:
    a ResultSet that contains the data produced by the query; never null
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### executeUpdate

    public int executeUpdate(java.sql.Statement stmt,
                             java.lang.String sql)
                      throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Execute a SQL INSERT, UPDATE or DELETE statement. Although SQL DDL statements can be executed, it is not advised since doing so can cause the iFS repository to be non-functional or irreparable.

  Parameters:
    `stmt` - the Statement
    `sql` - a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
  Returns:
    either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### execute

    public boolean execute(java.sql.Statement stmt,
                           java.lang.String sql)
                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

  Parameters:
    `stmt` - any SQL statement
    `sql` - the SQL string
  Returns:
    true if the next result is a ResultSet; false if it is an update count or there are no more results
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### executeBatch

    public int[] executeBatch(java.sql.Statement stmt)
                       throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.

  Parameters:
    `stmt` - any SQL statement
  Returns:
    an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### executeQuery

    public java.sql.ResultSet executeQuery(java.sql.PreparedStatement pstmt)
                                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  A prepared SQL query is executed and its ResultSet is returned.

  Parameters:
    `pstmt` - the SQL statement
  Returns:
    a ResultSet that contains the data produced by the query; never null
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### executeUpdate

    public int executeUpdate(java.sql.PreparedStatement pstmt)
                      throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Execute a SQL INSERT, UPDATE or DELETE statement. Although SQL DDL statements can be executed, it is not advised since doing so can cause the iFS repository to be non-functional or irreparable.

  Parameters:
    `pstmt` - the SQL statement
  Returns:
    either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### execute

    public boolean execute(java.sql.PreparedStatement pstmt)
                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.

  Parameters:
    `pstmt` - the SQL statement
  Returns:
    execution status
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### nativeSQL

    public java.lang.String nativeSQL(java.lang.String sql)
                               throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent.

  Parameters:
    `sql` - a SQL statement that may contain one or more '?' parameter placeholders
  Returns:
    the native form of this statement
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### setAutoCommit

    public void setAutoCommit(boolean autoCommit)
                       throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.

  Parameters:
    `autoCommit` - true enables auto-commit; false disables auto-commit.
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### getAutoCommit

    public boolean getAutoCommit()
                          throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Get the current auto-commit state.

  Returns:
    Current state of auto-commit mode.
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### commit

    public void commit()
                throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the ConnectionWrapper. This method should only be used when auto commit has been disabled.

  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### rollback

    public void rollback()
                  throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the ConnectionWrapper. This method should only be used when auto commit has been disabled.

  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### isClosed

    public boolean isClosed()
                     throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Tests to see if an ConnectionWrapper is closed.

  Returns:
    true if the connection is closed; false if still open
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### getMetaData

    public java.sql.DatabaseMetaData getMetaData()
                                          throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  An ConnectionWrapper's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object.

  Returns:
    a DatabaseMetaData object for this ConnectionWrapper
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### setReadOnly

    public void setReadOnly(boolean readOnly)
                     throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  You can put a connection in read-only mode as a hint to enable database optimizations.

  Note: setReadOnly cannot be called while in the middle of a transaction.

  Parameters:
    `readOnly` - true enables read-only mode; false disables read-only mode.
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### isReadOnly

    public boolean isReadOnly()
                       throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Tests to see if the connection is in read-only mode.

  Returns:
    true if connection is read-only
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### setCatalog

    public void setCatalog(java.lang.String catalog)
                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  A sub-space of this ConnectionWrapper's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request.

  Parameters:
    `catalog` - tthe catalog name
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### getCatalog

    public java.lang.String getCatalog()
                                throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Return the ConnectionWrapper's current catalog name.

  Returns:
    the current catalog name or null
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### setTransactionIsolation

    public void setTransactionIsolation(int level)
                                 throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.

  Note: setTransactionIsolation cannot be called while in the middle of a transaction.

  Parameters:
    `level` - one of the TRANSACTION_* isolation values with the exception of TRANSACTION_NONE; some databases may not support other values
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Unpublished)

### getTransactionIsolation

    public int getTransactionIsolation()
                                throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Get this ConnectionWrapper's current transaction isolation mode.

  Returns:
    the current TRANSACTION_* mode value
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### getWarnings

    public java.sql.SQLWarning getWarnings()
                                    throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  The first warning reported by calls on this ConnectionWrapper is returned.

  Note: Subsequent warnings will be chained to this SQLWarning.

  Returns:
    the first SQLWarning or null
  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### clearWarnings

    public void clearWarnings()
                       throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  After this call, getWarnings returns null until a new warning is reported for this ConnectionWrapper.

  Throws:
    `java.sql.SQLException` - if a database-access error occurs.
  (Published)

### dispose

    public void dispose()
                 throws java.sql.SQLException

  Description copied from class: `ConnectionWrapper`
  Dispose the ConnectionWrapper and any IfsStatement objects.

  Throws:
    `java.sql.SQLException` - if the operation fails
  (Unpublished)

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