com.ibm.ims.db
Class DLIQueryConnection

java.lang.Object
  |
  +--com.ibm.ims.db.DLIQueryConnection
All Implemented Interfaces:
java.sql.Connection

public class DLIQueryConnection
extends java.lang.Object
implements java.sql.Connection


Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
protected DLIQueryConnection(DLIConnection dliConnection)
          Creates a connection with a DL/I database using an existing DLIConnection.
  DLIQueryConnection(java.lang.String databaseViewName)
          Creates a connection with a DL/I database.
 
Method Summary
 void clearWarnings()
           
 void close()
          Closes the associated DLIConnection Object if it is not externally managed, and resets its DLIConnection pointer.
 void commit()
          This function is not supported
 java.sql.Statement createStatement()
          Implements the Connection.createStatement() method returning a DLIStatement object as its parent class Statement.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          Implements the Connection.createStatement() method returning a DLIStatement object as its parent class Statement.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 AIB getAIB()
          Returns the Application Interface Block (AIB) used by the connection.
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
          This function is not supported
 DLIConnection getDLIConnection()
          Returns the DLIConnection associated with the DLIQueryConnection.
 int getHoldability()
          This function is not supported Retrieves the current holdability of ResultSet objects created using this Connection object.
 java.sql.DatabaseMetaData getMetaData()
           
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
          This function is not supported
 java.sql.SQLWarning getWarnings()
           
 boolean isClosed()
           
 boolean isReadOnly()
           
 java.lang.String nativeSQL(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          This function is not supported
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          This function is not supported
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          This function is not supported Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Implements the Connection.prepareStatement() method returning a DLIPreparedStatement object as its parent class PreparedStatement Result sets created using the returned PreparedStatement will have forward-only type and read-only concurrency, by default.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys)
          This function is not supported Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes)
          This function is not supported Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          Implements the Connection.prepareStatement() method returning a DLIPreparedStatement object as its parent class PreparedStatement Result sets created using the returned PreparedStatement will have forward-only type and read-only concurrency, by default.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
          This function is not supported Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
          This function is not supported Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
protected  void resetPhysicalConnection(DLIConnection dliConnection)
          Resets the DLIConnection stored in the object (needed for defered creation of DLIConnection.
 void rollback()
          This function is not supported
 void setAutoCommit(boolean autoCommit)
          autoCommit = true is not supported
 void setCatalog(java.lang.String catalog)
          This function is not supported
 void setHoldability(int holdability)
          This function is not supported Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(java.util.Map map)
          This function is not supported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DLIQueryConnection

public DLIQueryConnection(java.lang.String databaseViewName)
Creates a connection with a DL/I database.
Parameters:
databaseViewName - the fully qualified name of the DLIDatabaseView subclass.

DLIQueryConnection

protected DLIQueryConnection(DLIConnection dliConnection)
Creates a connection with a DL/I database using an existing DLIConnection. When we create a Connection from an existing DLIConnection, we don't manage the close of that DLIConnection but assume it is handled externally (for example by the ManagedConnection).
Parameters:
dliConnection - the existing DLIConnection
Method Detail

getAIB

public AIB getAIB()
Returns the Application Interface Block (AIB) used by the connection.
Returns:
AIB The Application Interface Block (AIB).

getDLIConnection

public DLIConnection getDLIConnection()
Returns the DLIConnection associated with the DLIQueryConnection. This is primarily to be used when SQL syntax cannot satisfy a query and SSAs must be used. When finished with the connection, you must call close on the java.sql.Connection object, not the DLIConnection object.
Returns:
DLIConnection The DLIConnection

resetPhysicalConnection

protected void resetPhysicalConnection(DLIConnection dliConnection)
Resets the DLIConnection stored in the object (needed for defered creation of DLIConnection.

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Implements the Connection.createStatement() method returning a DLIStatement object as its parent class Statement. Result sets created using the returned Statement object will by default have forward-only type and read-only concurrency.
Specified by:
createStatement in interface java.sql.Connection
Returns:
a new Statement object
Throws:
java.sql.SQLException - if a database access error occurs

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Implements the Connection.prepareStatement() method returning a DLIPreparedStatement object as its parent class PreparedStatement Result sets created using the returned PreparedStatement will have forward-only type and read-only concurrency, by default.
Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
sql - a SQL statement that may contain one or more '?' IN parameter placeholders
Returns:
a new PreparedStatement object containing the pre-compiled statement
Throws:
java.sql.SQLException - if a database access error occurs

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
This function is not supported
Specified by:
prepareCall in interface java.sql.Connection

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Specified by:
nativeSQL in interface java.sql.Connection

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
autoCommit = true is not supported
Specified by:
setAutoCommit in interface java.sql.Connection

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Specified by:
getAutoCommit in interface java.sql.Connection

commit

public void commit()
            throws java.sql.SQLException
This function is not supported
Specified by:
commit in interface java.sql.Connection

rollback

public void rollback()
              throws java.sql.SQLException
This function is not supported
Specified by:
rollback in interface java.sql.Connection

close

public void close()
           throws java.sql.SQLException
Closes the associated DLIConnection Object if it is not externally managed, and resets its DLIConnection pointer.
Specified by:
close in interface java.sql.Connection

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Connection

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.Connection

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Specified by:
setReadOnly in interface java.sql.Connection

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Specified by:
isReadOnly in interface java.sql.Connection

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
This function is not supported
Specified by:
setCatalog in interface java.sql.Connection

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
This function is not supported
Specified by:
getCatalog in interface java.sql.Connection

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Specified by:
setTransactionIsolation in interface java.sql.Connection

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Specified by:
getTransactionIsolation in interface java.sql.Connection

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Specified by:
getWarnings in interface java.sql.Connection

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Connection

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
Implements the Connection.createStatement() method returning a DLIStatement object as its parent class Statement.
Specified by:
createStatement in interface java.sql.Connection
Parameters:
resultSetType - a result set type; see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
Returns:
a new Statement object
Throws:
java.sql.SQLException - if a database access error occurs

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
Implements the Connection.prepareStatement() method returning a DLIPreparedStatement object as its parent class PreparedStatement Result sets created using the returned PreparedStatement will have forward-only type and read-only concurrency, by default.
Specified by:
prepareStatement in interface java.sql.Connection
Parameters:
sql - a SQL statement that may contain one or more '?' IN parameter placeholders
resultSetType - a result set type; see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
Returns:
a new PreparedStatement object containing the pre-compiled SQL statement
Throws:
java.sql.SQLException - if a database access error occurs

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
This function is not supported
Specified by:
prepareCall in interface java.sql.Connection

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
This function is not supported
Specified by:
getTypeMap in interface java.sql.Connection

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
This function is not supported
Specified by:
setTypeMap in interface java.sql.Connection

setHoldability

public void setHoldability(int holdability)
                    throws java.sql.SQLException
This function is not supported Changes the holdability of ResultSet objects created using this Connection object to the given holdability.
Parameters:
holdability - a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Throws:
java.sql.SQLException - if a database access occurs, the given parameter is not a ResultSet constant indicating holdability, or the given holdability is not supported
Since:
1.4
See Also:
getHoldability(), ResultSet

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
This function is not supported Retrieves the current holdability of ResultSet objects created using this Connection object.
Returns:
the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Throws:
java.sql.SQLException - if a database access occurs
Since:
1.4
See Also:
setHoldability(int), ResultSet

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability)
                                            throws java.sql.SQLException
This function is not supported Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.

This method is the same as the prepareStatement method above, but it allows the default result set type, concurrency, and holdability to be overridden.

Parameters:
sql - a String object that is the SQL statement to be sent to the database; may contain one or more ? IN parameters
resultSetType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Returns:
a new PreparedStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
Throws:
java.sql.SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
Since:
1.4
See Also:
ResultSet

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException
This function is not supported Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareCall method above, but it allows the default result set type, result set concurrency type and holdability to be overridden.
Parameters:
sql - a String object that is the SQL statement to be sent to the database; may contain on or more ? parameters
resultSetType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetHoldability - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Returns:
a new CallableStatement object, containing the pre-compiled SQL statement, that will generate ResultSet objects with the given type, concurrency, and holdability
Throws:
java.sql.SQLException - if a database access error occurs or the given parameters are not ResultSet constants indicating type, concurrency, and holdability
Since:
1.4
See Also:
ResultSet

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int autoGeneratedKeys)
                                            throws java.sql.SQLException
This function is not supported Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement.

Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, the method prepareStatement 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 PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql - an SQL statement that may contain one or more '?' IN parameter placeholders
autoGeneratedKeys - a flag indicating whether auto-generated keys should be returned; one of the following Statement constants:
autoGeneratedKeys - a flag indicating that auto-generated keys should be returned, one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS.
Returns:
a new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
Throws:
java.sql.SQLException - if a database access error occurs or the given parameter is not a Statement constant indicating whether auto-generated keys should be returned
Since:
1.4

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] columnIndexes)
                                            throws java.sql.SQLException
This function is not supported Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. This array is ignored if the SQL statement is not an INSERT statement.

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement 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, the method prepareStatement 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 PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql - an SQL statement that may contain one or more '?' IN parameter placeholders
columnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row or rows
Returns:
a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column indexes
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.4

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   java.lang.String[] columnNames)
                                            throws java.sql.SQLException
This function is not supported Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. This array is ignored if the SQL statement is not an INSERT statement.

An SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement 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, the method prepareStatement 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 PreparedStatement object is executed. This has no direct effect on users; however, it does affect which methods throw certain SQLExceptions.

Result sets created using the returned PreparedStatement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY.

Parameters:
sql - an SQL statement that may contain one or more '?' IN parameter placeholders
columnNames - an array of column names indicating the columns that should be returned from the inserted row or rows
Returns:
a new PreparedStatement object, containing the pre-compiled statement, that is capable of returning the auto-generated keys designated by the given array of column names
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.4


(C) International Business Machines Corporation 2004. All rights reserved.