ca.idms.jdbc
Class IdmsConnection

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.jdbc.IdmsJdbcObject
          extended by ca.idms.jdbc.IdmsConnection
All Implemented Interfaces:
Trace, IdmsDriverInterface, SQLState

public class IdmsConnection
extends IdmsJdbcObject
implements IdmsDriverInterface

Represents a JDBC connection with an IDMS database. Contains a main Session to support SQL requests and a TRANSIENT READ session for database metadata queries.

Version:
3.00, 10/17/05
Author:
Dave Ross
See Also:
IdmsJdbcObject, IdmsJdbcDriver, IdmsStatement, IdmsPreparedStatement, IdmsCallableStatement

Field Summary
static java.lang.String DICTIONARY
          Key name that identifies the database in internal data source definitions.
static java.lang.String RELOAD
          Property name to enable refresh of options.
static ca.idms.qcli.Sqlpib SQLPIB
          SQL Program Information Block for CA_IDMS JDBC Driver.
static java.lang.String TEMP_DSN
          Identifies the "temporary data source" used when all connection information is specified in the DataSource object instead of using the configuration file.
 
Fields inherited from class ca.idms.jdbc.IdmsJdbcObject
FAKE_METHODS, FAKE_SUPPORT, fakeSupport, MESSAGES
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Fields inherited from interface ca.idms.jdbc.IdmsDriverInterface
ACCOUNT, BATCH, CCIHOST, CCIPORT, CSUSPEND, CUSTOM, DEF_CCIPORT, DEF_TASK, DEFSCHEM, EWAIT, INFO, INTERACTIVE, NODE, PASSWORD, PROGRAM, RSINT, SBUFLEN, SERVICE, SSL, STRACE, SUSPEND, TASK, USER, VIA
 
Fields inherited from interface ca.idms.qcli.SQLState
SQL_00000, SQL_01000, SQL_01004, SQL_07001, SQL_07009, SQL_08001, SQL_08002, SQL_08003, SQL_08004, SQL_08006, SQL_08007, SQL_0A000, SQL_21000, SQL_22000, SQL_22001, SQL_22003, SQL_22005, SQL_22007, SQL_24000, SQL_25000, SQL_3C000, SQL_40000, SQL_42000, SQL_HY000, SQL_HY004, SQL_HY009, SQL_HY010, SQL_HY024, SQL_HY106, SQL_HYC00
 
Method Summary
 void addCursorName(java.lang.String name)
          Adds a name to the cursor name table to enforce uniqueness.
 void addStatement(IdmsStatement stmt)
          Adds an object to the connection's statement table.
 void close()
          Immediately releases a Connection's database and JDBC resources.
 void commit()
          Commits the transaction.
 java.sql.Array createArrayOf(java.lang.String arg0, java.lang.Object[] arg1)
          IDMS does not support the ARRAY type.
 java.sql.Blob createBlob()
          IDMS does not support the BLOB type.
 java.sql.Clob createClob()
          IDMS does not support the CLOB type.
 java.sql.NClob createNClob()
          IDMS does not support the NCLOB type.
 java.sql.SQLXML createSQLXML()
          IDMS does not support the SQLMXL type.
 java.sql.Statement createStatement()
          Creates an IDMS statement.
 java.sql.Statement createStatement(int type, int conc)
          Creates an CA IDMS Statement with the specified type and concurrency.
 java.sql.Statement createStatement(int type, int conc, int hold)
          Creates an IDMS Statement with specified type, concurrency, and holdability.
 java.sql.Struct createStruct(java.lang.String arg0, java.lang.Object[] arg1)
          IDMS does not support the STRUCT type.
protected  void finalize()
          Cleans up when the IDMS JDBC driver object goes away.
protected  java.lang.Object get(java.lang.reflect.Field f)
          Allows the default snap method access to non-public variables.
 boolean getAutoCommit()
          Get the current auto-commit mode.
 java.lang.String getCatalog()
          Return the connection's CURRENT DATABASE name.
 java.util.Properties getClientInfo()
          Returns the set of ClientInfo properties and their associated values.
 java.lang.String getClientInfo(java.lang.String s)
          Returns the current value of a ClientInfo property, or null if the property doesn't exist.
 java.lang.Object[][] getClientInfoObjects()
          Instantiates a clientInfo object if it doesn't already exist, then obtains an array of Object arrays which represent the name, maximum length, default value and description of all ClientInfo properties.
 int getHoldability()
          Gets current ResultSet holdability for this connection.
 java.sql.DatabaseMetaData getMetaData()
          Gets information about the connected database.
 int getTransactionIsolation()
          Get this Connection's current transaction isolation level.
 java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
          IDMS does not support user defined types.
 boolean isClosed()
          Tests to see if a Connection is closed.
 boolean isGlobalTransaction()
          Indicates that the transaction mode is global.
 boolean isPooledConnection()
          Indicates a PooledConnection.
 boolean isReadOnly()
          Tests to see if the connection is in read-only mode.
 boolean isTmgrSessionError(int sqlerc)
          Indicates that a TMGR non-fatal session error.
 boolean isValid(int t)
          Returns true if the connection has not been closed and is still valid.
 boolean isXAConnection()
          Indicates an XAConnection.
 java.lang.String nativeSQL(java.lang.String sql)
          Converts an SQL statement to the native CA IDMS grammar.
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          Prepares an IDMS procedure call.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int conc)
          Prepares an IDMS CALL Statement with specified type and concurrency.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int type, int conc, int hold)
          Prepares an IDMS CALL Statement with specified type, concurrency, and holdability.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          Prepares an IDMS statement.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int key)
          Prepares an IDMS statement.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] index)
          Prepares an IDMS statement.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int conc)
          Prepares an CA IDMS Statement with specified type and concurrency.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int type, int conc, int hold)
          Prepares an IDMS Statement with specified type, concurrency, and holdability.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] names)
          Prepares an IDMS statement.
 void releaseSavepoint(java.sql.Savepoint savepoint)
          IDMS does does support Savepoints.
 void removeCursorName(java.lang.String name)
          Removes a name from the cursor name table.
 void removeStatement(IdmsStatement stmt)
          Removes an object from the connection's statement table.
 void resetClientInfo()
          resets the ClientInfo properties, if they exist.
 void rollback()
          Rolls back the transaction.
 void rollback(java.sql.Savepoint savepoint)
          IDMS does does support Savepoints.
 void setAutoCommit(boolean autoCommit)
          Enables or disables auto-commit mode.
 void setCatalog(java.lang.String catalog)
          Satisfies Connection interface, this method does nothing.
 void setClientInfo(java.util.Properties p)
          Sets ClientInfo properties to those passed by the application.
 void setClientInfo(java.lang.String k, java.lang.String v)
          Sets a ClientInfo property as requested by the application.
 void setHoldability(int opt)
          Sets the current holdability for all ResultSets.
 void setIdentity()
          Sends the external identity to CA IDMS.
 void setIdentity(java.lang.String id)
          Sends an external identity to CA IDMS.
 void setReadOnly(boolean readOnly)
          Enables or disables read-only mode.
 java.sql.Savepoint setSavepoint()
          IDMS does does support Savepoints.
 java.sql.Savepoint setSavepoint(java.lang.String name)
          IDMS does does support Savepoints.
 void setTransactionIsolation(int level)
          Sets the transaction isolation level.
 void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
          IDMS does not support user defined types.
 void suspend()
          Suspends the main and catalog connections.
 
Methods inherited from class ca.idms.jdbc.IdmsJdbcObject
clearWarnings, getWarnings, hasCursor, hasUpdate, isStarted, isSuspended, isWrapperFor, notifyStatementError, unwrap
 
Methods inherited from class ca.idms.io.TraceObject
getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Connection
clearWarnings, getWarnings
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

SQLPIB

public static final ca.idms.qcli.Sqlpib SQLPIB
SQL Program Information Block for CA_IDMS JDBC Driver.


RELOAD

public static final java.lang.String RELOAD
Property name to enable refresh of options. When this property is enabled in the System properties or CA IDMS properties file the JDBC driver will clear the CA IDMS properties and configuration file cache when the last connection is closed and reload it when the next connection is created.

This allows options to be changed without recycling the application server. This can be useful to enable or disable the global trace. To enable it ddd this to the command that starts the Java VM:

-Dca.idms.reload=true

Or add this to the CA IDMS properties file (usually caidms.properties):

reload=true

Note that the reload setting itself is only checked when this class is initialized, so the only way to change it is to unload this class, which usually means recycling the application server.

See Also:
Constant Field Values

TEMP_DSN

public static final java.lang.String TEMP_DSN
Identifies the "temporary data source" used when all connection information is specified in the DataSource object instead of using the configuration file.

See Also:
Constant Field Values

DICTIONARY

public static final java.lang.String DICTIONARY
Key name that identifies the database in internal data source definitions.

See Also:
Constant Field Values
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleans up when the IDMS JDBC driver object goes away.

Overrides:
finalize in class TraceObject
Throws:
java.lang.Throwable - not really.

get

protected java.lang.Object get(java.lang.reflect.Field f)
                        throws java.lang.IllegalAccessException
Allows the default snap method access to non-public variables.

Overrides:
get in class IdmsJdbcObject
Parameters:
f - a Field returned by Class.getDeclaredFields
Returns:
the Object named by f
Throws:
java.lang.IllegalAccessException - should not happen
See Also:
TraceObject.snap, TraceObject.snap()

close

public void close()
           throws java.sql.SQLException
Immediately releases a Connection's database and JDBC resources. This method terminates the network connection to IDMS. IDMS terminates any SQL sessions still existing with a ROLLBACK RELEASE.

Throws:
java.sql.SQLException - does not happen.

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Tests to see if a Connection is closed.

Returns:
true if the connection is closed; false if it's still open
Throws:
java.sql.SQLException - if a database error occurs.

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Creates an IDMS statement.

Returns:
a new Statement object
Throws:
java.sql.SQLException - if a database error occurs.

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Prepares an IDMS statement. This minimally parses the syntax and translates it to the native format. The statement is not sent to the database and actually prepared until it is executed. This allows compatibility with IDMS 12.0 and allows the use of "piggybacked" calls for efficiency.

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 error occurs.

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Prepares an IDMS procedure call.

Parameters:
sql - a SQL statement that may contain a CALL command
Returns:
an IdmsCallableStatement object
Throws:
java.sql.SQLException - if a database error occurs

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Converts an SQL statement to the native CA IDMS grammar.

Parameters:
sql - a SQL statement
Returns:
the native form of this statement
Throws:
java.sql.SQLException - if a database error occurs.

commit

public void commit()
            throws java.sql.SQLException
Commits the transaction. When holdbility (or the "preserve" option) is enabled and there are one or more prepared statements or open cursors on the connection a COMMIT CONTINUE will be issued, which will preserve cursor currency.

Throws:
java.sql.SQLException - if a database error occurs.
See Also:
setAutoCommit(boolean)

rollback

public void rollback()
              throws java.sql.SQLException
Rolls back the transaction. This method should only be used when auto commit is disabled.

Throws:
java.sql.SQLException - if a database error occurs.
See Also:
setAutoCommit(boolean)

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Satisfies Connection interface, this method does nothing. The "catalog" for IDMS is the dbname of the dictionary containing the definitions of the tables. It is set when the connection is established and cannot be changed.

Parameters:
catalog - ignored.
Throws:
java.sql.SQLException - NOT!

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Return the connection's CURRENT DATABASE name. This method invokes DatabaseMetaData.getCatalogs, which returns a single row containing the CURRENT DATABASE (if the user can access any tables at all). Otherwise it returns the DICTIONARY name specified for the connection if available, as a lost resort it returns the data source subname from the URL.

Note that this can be a relatively expensive operation, since it executes a catalog query to get the actual database name the first time it is invoked. After that it returns the cached catalog name.

Returns:
the CURRENT DATABASE.
Throws:
java.sql.SQLException - if an error occurs.

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Gets information about the connected database.

Returns:
a DatabaseMetaData object for this Connection
Throws:
java.sql.SQLException - if a database error occurs.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Enables or disables 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.

That is the Sun javadoc, for CA IDMS the COMMIT is not issued when the cursor is closed if there are other open cursors.

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

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Get the current auto-commit mode.

Returns:
Current state of auto-commit mode.
Throws:
java.sql.SQLException - if a database error occurs.
See Also:
setAutoCommit(boolean)

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Enables or disables read-only mode.

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

Parameters:
readOnly - true enables read-only; false disables read-only.
Throws:
java.sql.SQLException - if a database 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 error occurs.

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Sets the transaction isolation level.

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 error occurs.

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Get this Connection's current transaction isolation level.

Returns:
the current TRANSACTION_* mode value
Throws:
java.sql.SQLException - if a database error occurs.

createStatement

public java.sql.Statement createStatement(int type,
                                          int conc)
                                   throws java.sql.SQLException
Creates an CA IDMS Statement with the specified type and concurrency. The CA IDMS JDBC driver supports the following result set types and concurrency:
  • TYPE_FORWARD_ONLY
  • TYPE_SCROLL_INSENSITIVE
  • CONCUR_READ_ONLY If an application specifies TYPE_SCROLL_SENSITIVE the driver changes the type to TYPE_SCROLL_INSENSITIVE and generates an SQLWarning. If an application specifies CONCUR_UPDATABLE changes the concurrency to CONCUR_READ_ONLY and generates an SQLWarning.

    This behavior conforms to the JDBC 4.0 Specification (JSR 221) and other documents written by the JDBC specification writers. Note that the Java 6 API specification (javadoc) indicates that the driver should throw an SQLFeatureNotSupportedException if the application requests an unsupported type or concurrency. This is inconsistent with JSR 221 and appears to be an implementation error.

    Parameters:
    type - ResultSet type
    conc - ResultSet concurrency
    Returns:
    an IdmsStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.2

  • prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int type,
                                                       int conc)
                                                throws java.sql.SQLException
    Prepares an CA IDMS Statement with specified type and concurrency. The driver returns supported type and concurrency options as described in createStatement(int, int).

    Parameters:
    sql - SQL statement to prepare
    type - ResultSet type
    conc - ResultSet concurrency
    Returns:
    an IdmsPreparedStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.2

    prepareCall

    public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                                  int type,
                                                  int conc)
                                           throws java.sql.SQLException
    Prepares an IDMS CALL Statement with specified type and concurrency. The driver returns supported type and concurrency options as described in createStatement(int, int).

    Parameters:
    sql - SQL statement to prepare
    type - ResultSet type
    conc - ResultSet concurrency
    Returns:
    an IdmsCallableStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.2

    getTypeMap

    public java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
                                                                  throws java.sql.SQLException
    IDMS does not support user defined types. This method is provided only to avoid compatibility problems. The default map is an empty HashTable, and is only created when and if this method is called.

    Returns:
    the current Map object, for what it's worth
    Throws:
    java.sql.SQLException - never
    Since:
    1.2

    setTypeMap

    public void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
                    throws java.sql.SQLException
    IDMS does not support user defined types. The driver will not use the specified map when returning data from a ResultSet, but will return the map reference if asked.

    Parameters:
    map - the Map object, which we won't really use
    Throws:
    java.sql.SQLException - never
    Since:
    1.2

    setHoldability

    public void setHoldability(int opt)
                        throws java.sql.SQLException
    Sets the current holdability for all ResultSets. All ResultSets created in this connection have the same holdability option. This means that specifying the holdability option on one of the create or prepare methods is equivalent to invoking this method first. Either sets the effective holdability for all existing ResultSets as well as any new ones created. If HOLD_CURSORS_OVER_COMMIT is specified and there are open cursors, a COMMIT CONTINUE is issued when the transaction is committed, preserving cursor currency and prepared statements.

    If CLOSE_CURSORS_AT_COMMIT is specified (the default), or there are no open cursors, a COMMIT is issued, closing all open cursors and deallocating all prepared statements. The syntax of prepared statements is cached, which allows them to be prepared again as necessary.

    Parameters:
    opt - ResultSet holdability option
    Throws:
    java.sql.SQLException - if an invalid option is specified
    Since:
    1.4
    See Also:
    createStatement(int,int), prepareStatement(String,int,int), prepareCall(String,int,int)

    getHoldability

    public int getHoldability()
                       throws java.sql.SQLException
    Gets current ResultSet holdability for this connection.

    Returns:
    current holdability option
    Throws:
    java.sql.SQLException - never
    Since:
    1.4
    See Also:
    setHoldability(int)

    setSavepoint

    public java.sql.Savepoint setSavepoint()
                                    throws java.sql.SQLException
    IDMS does does support Savepoints.

    Returns:
    never
    Throws:
    java.sql.SQLException - always
    Since:
    1.4
    See Also:
    IdmsJdbcObject.fakeSupport

    setSavepoint

    public java.sql.Savepoint setSavepoint(java.lang.String name)
                                    throws java.sql.SQLException
    IDMS does does support Savepoints.

    Parameters:
    name - Savepoint name
    Returns:
    never
    Throws:
    java.sql.SQLException - always
    Since:
    1.4
    See Also:
    IdmsJdbcObject.fakeSupport

    rollback

    public void rollback(java.sql.Savepoint savepoint)
                  throws java.sql.SQLException
    IDMS does does support Savepoints.

    Parameters:
    savepoint - Savepoint object, ignored
    Throws:
    java.sql.SQLException - always
    Since:
    1.4
    See Also:
    IdmsJdbcObject.fakeSupport

    releaseSavepoint

    public void releaseSavepoint(java.sql.Savepoint savepoint)
                          throws java.sql.SQLException
    IDMS does does support Savepoints.

    Parameters:
    savepoint - Savepoint object, ignored
    Throws:
    java.sql.SQLException - always
    Since:
    1.4
    See Also:
    IdmsJdbcObject.fakeSupport

    createStatement

    public java.sql.Statement createStatement(int type,
                                              int conc,
                                              int hold)
                                       throws java.sql.SQLException
    Creates an IDMS Statement with specified type, concurrency, and holdability. For CA IDMS this is equivalent to calling setHoldability followed by createStatement. The driver returns supported type and concurrency options as described in createStatement(int, int).

    Parameters:
    type - ResultSet type
    conc - ResultSet concurrency
    hold - ResultSet holdability
    Returns:
    an IdmsStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.4
    See Also:
    setHoldability(int), createStatement(int, int)

    prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int type,
                                                       int conc,
                                                       int hold)
                                                throws java.sql.SQLException
    Prepares an IDMS Statement with specified type, concurrency, and holdability. For CA IDMS this is equivalent to calling setHoldability followed by prepareStatement. The driver returns supported type and concurrency options as described in createStatement(int, int).

    Parameters:
    sql - SQL statement to prepare
    type - ResultSet type
    conc - ResultSet concurrency
    hold - ResultSet holdability, sets for all
    Returns:
    an IdmsPreparedStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.4
    See Also:
    setHoldability(int)

    prepareCall

    public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                                  int type,
                                                  int conc,
                                                  int hold)
                                           throws java.sql.SQLException
    Prepares an IDMS CALL Statement with specified type, concurrency, and holdability. For CA IDMS this is equivalent to calling setHoldability followed by prepareStatement. The driver returns supported type and concurrency options as described in createStatement(int, int).

    Parameters:
    sql - SQL CALL statement to prepare
    type - ResultSet type
    conc - ResultSet concurrency
    hold - ResultSet holdability, sets for all
    Returns:
    an IdmsCallableStatement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.4
    See Also:
    setHoldability(int)

    prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int key)
                                                throws java.sql.SQLException
    Prepares an IDMS statement. IDMS does not support auto generated keys, so this method is equivalent to prepareStatement(String). Calling the statement's getAutogeneratedKeys will just return an empty ResultSet.

    Parameters:
    sql - SQL statement
    key - auto generated key flag, ignored
    Returns:
    the prepared statement object
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.4

    prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       int[] index)
                                                throws java.sql.SQLException
    Prepares an IDMS statement. IDMS does not support auto generated keys, so this method is equivalent to prepareStatement(String). Calling the statement's getAutogeneratedKeys will just return an empty ResultSet.

    Parameters:
    sql - SQL statement
    index - auto generated key ordinal array, ignored
    Returns:
    the prepared statement object, maybe
    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    1.4

    prepareStatement

    public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                       java.lang.String[] names)
                                                throws java.sql.SQLException
    Prepares an IDMS statement. IDMS does not support auto generated keys, so this method is equivalent to prepareStatement(String). Calling the statement's getAutogeneratedKeys will just return an empty ResultSet.

    Parameters:
    sql - SQL statement
    names - auto generated key column name array, ignored
    Returns:
    the prepared statement object
    Throws:
    java.sql.SQLException - if we can't do it or an error occurs
    Since:
    1.4

    createArrayOf

    public java.sql.Array createArrayOf(java.lang.String arg0,
                                        java.lang.Object[] arg1)
                                 throws java.sql.SQLException
    IDMS does not support the ARRAY type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    createBlob

    public java.sql.Blob createBlob()
                             throws java.sql.SQLException
    IDMS does not support the BLOB type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    createClob

    public java.sql.Clob createClob()
                             throws java.sql.SQLException
    IDMS does not support the CLOB type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    createNClob

    public java.sql.NClob createNClob()
                               throws java.sql.SQLException
    IDMS does not support the NCLOB type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    createSQLXML

    public java.sql.SQLXML createSQLXML()
                                 throws java.sql.SQLException
    IDMS does not support the SQLMXL type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    createStruct

    public java.sql.Struct createStruct(java.lang.String arg0,
                                        java.lang.Object[] arg1)
                                 throws java.sql.SQLException
    IDMS does not support the STRUCT type.

    Throws:
    java.sql.SQLException - always
    Since:
    1.6

    getClientInfo

    public java.util.Properties getClientInfo()
                                       throws java.sql.SQLException
    Returns the set of ClientInfo properties and their associated values.

    Throws:
    java.sql.SQLException - if connection is closed
    Since:
    1.6

    getClientInfo

    public java.lang.String getClientInfo(java.lang.String s)
                                   throws java.sql.SQLException
    Returns the current value of a ClientInfo property, or null if the property doesn't exist.

    Parameters:
    s - the property key
    Throws:
    java.sql.SQLException - if connection is closed
    Since:
    1.6

    isValid

    public boolean isValid(int t)
                    throws java.sql.SQLException
    Returns true if the connection has not been closed and is still valid. The driver sends a query to the IDMS system to verify the connection.

    Parameters:
    t - the number of seconds to wait for completion of the validating query to the IDMS system.
    Throws:
    java.sql.SQLException - if the requested timeout value is less than zero.
    Since:
    1.6

    setClientInfo

    public void setClientInfo(java.util.Properties p)
                       throws java.sql.SQLClientInfoException
    Sets ClientInfo properties to those passed by the application. Any ClientInfo properties which are not included, but were previously set by the application, are set to their default values.

    Parameters:
    p - a collection of ClientInfo properties to be set.
    Throws:
    java.sql.SQLClientInfoException - - if one or more of the properties fails to be set, or this method is called on a closed connection.
    Since:
    1.6

    setClientInfo

    public void setClientInfo(java.lang.String k,
                              java.lang.String v)
                       throws java.sql.SQLClientInfoException
    Sets a ClientInfo property as requested by the application. If the property key is not supported, a SQLWarning is created

    Parameters:
    k - property key
    v - property value
    Throws:
    java.sql.SQLClientInfoException - - the property fails to be set.
    Since:
    1.6

    setIdentity

    public void setIdentity(java.lang.String id)
                     throws java.sql.SQLException
    Sends an external identity to CA IDMS. This method can be used to send an application specified external user identity to CA IDMS to be recorded in the CA IDMS journal. The identity is cached and sent only if changed. This method cannot be invoked when an identity manager such as SiteMinder is in use or when not connected directly to CA IDMS (Type 4 driver).

    Parameters:
    id - the external user identity or null
    Throws:
    java.sql.SQLException - if an error occurs or an attempt is made to override the identity set by the identity manager
    Since:
    Server 16.1
    See Also:
    setIdentity()

    setIdentity

    public void setIdentity()
                     throws java.sql.SQLException
    Sends the external identity to CA IDMS. This method sends the external identity set by an identity manager such as CA SiteMinder to CA IDMS where it is recorded in the CA IDMS journal BGIN transaction record. It is normally invoked automatically when a new transaction is started. This method does nothing if identity auditing is not enabled or if the cached identity has not changed and cannot be invoked when not connected directly to CA IDMS (Type 4 driver).

    Throws:
    java.sql.SQLException - if an error occurs
    Since:
    Server 16.1

    addStatement

    public void addStatement(IdmsStatement stmt)
    Adds an object to the connection's statement table.

    Parameters:
    stmt - the statement object

    removeStatement

    public void removeStatement(IdmsStatement stmt)
    Removes an object from the connection's statement table.

    Parameters:
    stmt - the statement object

    addCursorName

    public void addCursorName(java.lang.String name)
                       throws java.sql.SQLException
    Adds a name to the cursor name table to enforce uniqueness.

    Parameters:
    name - the cursor name.
    Throws:
    java.sql.SQLException - if name is not unique.

    removeCursorName

    public void removeCursorName(java.lang.String name)
    Removes a name from the cursor name table.

    Parameters:
    name - the cursor name.

    isPooledConnection

    public boolean isPooledConnection()
    Indicates a PooledConnection.

    Returns:
    true if pooled, false otherwise
    See Also:
    IdmsPooledConnection

    isXAConnection

    public boolean isXAConnection()
    Indicates an XAConnection.

    Returns:
    true if XA, false otherwise
    See Also:
    IdmsXAConnection

    isGlobalTransaction

    public boolean isGlobalTransaction()
    Indicates that the transaction mode is global. This method is used when the connection is a PooledConnection. The transaction mode is global when the connection is participing in a distributed transaction.

    Returns:
    true if mode is global, false if local
    See Also:
    IdmsXAConnection

    isTmgrSessionError

    public boolean isTmgrSessionError(int sqlerc)
    Indicates that a TMGR non-fatal session error. Certain TMGR errors in R160 are reported as session failures. An XA connection can have multiple SQL sessions, only one of which may be affected by the TMGR error, so we may not need to notify the connection pool listeners. If the current session is:

    Parameters:
    sqlerc - SQL reason code from SQLCA
    Returns:
    true if still connected, false if not
    See Also:
    isTmgrSessionError(int)

    suspend

    public void suspend()
                 throws java.sql.SQLException
    Suspends the main and catalog connections. Invoked when the application closes a pooled connection.

    Throws:
    java.sql.SQLException
    See Also:
    IdmsLogicalConnection.close()

    getClientInfoObjects

    public java.lang.Object[][] getClientInfoObjects()
    Instantiates a clientInfo object if it doesn't already exist, then obtains an array of Object arrays which represent the name, maximum length, default value and description of all ClientInfo properties.

    Returns:
    array of Object arrays
    See Also:
    IdmsDatabaseMetaData.getClientInfoProperties()

    resetClientInfo

    public void resetClientInfo()
    resets the ClientInfo properties, if they exist. This is necessary if the connection is being pooled, according to the JDBC 4.0 spec. Makes sense anyway.



    Copyright © 2009 CA, All rights reserved