Oracle Content Management SDK

oracle.ifs.server.sql
Class IfsConnection

java.lang.Object
  |
  +--oracle.ifs.server.sql.IfsConnection

public class IfsConnection
extends java.lang.Object

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


Constructor Summary
IfsConnection(S_LibrarySession session)
          Constructs an IfsConnection which holds the Jdbc connection.
 
Method Summary
 void clearWarnings()
          After this call, getWarnings returns null until a new warning is reported for this IfsConnection.
 IfsStatement createStatement()
          SQL statements without parameters are normally executed using IfsStatement objects.
 boolean getAutoCommit()
          Get the current auto-commit state.
 java.lang.String getCatalog()
          Return the IfsConnection's current catalog name.
 java.sql.DatabaseMetaData getMetaData()
          An IfsConnection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.
 S_LibrarySession getSession()
          Return the session that requested this connection.
 int getTransactionIsolation()
          Get this IfsConnection's current transaction isolation mode.
 java.sql.SQLWarning getWarnings()
          The first warning reported by calls on this IfsConnection is returned.
 boolean isClosed()
          Tests to see if an IfsConnection 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.
 IfsCallableStatement prepareCall(java.lang.String sql)
          A SQL stored procedure call statement is handled by creating a IfsCallableStatement for it.
 IfsPreparedStatement prepareStatement(java.lang.String sql)
          A SQL statement with or without IN parameters can be pre-compiled and stored in an IfsPreparedStatement object.
 

Constructor Detail


IfsConnection

public IfsConnection(S_LibrarySession session)
              throws IfsException
Constructs an IfsConnection which holds the Jdbc connection. IfsConnection encapsulates java.sql.Connection with disabling of certain methods, such as commit(), rollback() and a few others.
Parameters:
session - the serverside LibrarySession
Throws:
IfsException - if the operation fails
Method Detail

getSession

public S_LibrarySession getSession()
Return the session that requested this connection.
Returns:
the session

createStatement

public IfsStatement createStatement()
                             throws java.sql.SQLException
SQL statements without parameters are normally executed using IfsStatement objects. If the same SQL statement is executed many times, it is more efficient to use a IfsPreparedStatement
Returns:
a new IfsStatement object
Throws:
java.sql.SQLException - if a database-access error occurs.

prepareStatement

public IfsPreparedStatement prepareStatement(java.lang.String sql)
                                      throws java.sql.SQLException
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.

prepareCall

public IfsCallableStatement prepareCall(java.lang.String sql)
                                 throws java.sql.SQLException
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.

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
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.

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Get the current auto-commit state.
Returns:
Current state of auto-commit mode.
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
setAutoCommit(boolean)

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Tests to see if an IfsConnection is closed.
Returns:
true if the connection is closed; false if it's still open
Throws:
java.sql.SQLException - if a database-access error occurs.

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
An IfsConnection'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 IfsConnection
Throws:
java.sql.SQLException - if a database-access error occurs.

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
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.

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Return the IfsConnection's current catalog name.
Returns:
the current catalog name or null
Throws:
java.sql.SQLException - if a database-access error occurs.

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Get this IfsConnection's current transaction isolation mode.
Returns:
the current TRANSACTION_* mode value
Throws:
java.sql.SQLException - if a database-access error occurs.

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
The first warning reported by calls on this IfsConnection 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.

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
After this call, getWarnings returns null until a new warning is reported for this IfsConnection.
Throws:
java.sql.SQLException - if a database-access error occurs.

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.