Connection and statement attributes

The ODBC specification defines several connection and statement attributes.

This ODBC specification is extended with several iSeries™ Access for Windows® customized attributes, that are described in the following 2 tables.

Table 1. Customized connection attributes
Attribute Get/Set Description
1204 both An unsigned value that controls the cursor commit behavior and cursor rollback behavior. Possible values:
  • 0 - SQL_CB_DELETE is returned for SQLGetInfo's SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR options.
  • 1 - (default) SQL_CB_PRESERVE is returned for SQLGetInfo's SQL _CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR options.
2100 both Can be used as an alternative to using the DFTPKGLIB connection string keyword This is a character string that specifies the default package library to be used. This should be set prior to preparing a statement on this connection.
2101 both This is a character string that specifies the package name to be used. This should be set prior to preparing a statement on this connection.
2103 get Returns an unsigned integer value which is the server CCSID value (job CCSID) that the ODBC connection is dealing with. By default, SQL statements will be sent to the host in this CCSID
2104 both Can be used as an alternative to the Divide by zero option of the DEBUG connection string keyword. This is an unsigned value indicating whether or not dividing a value by zero should return an error for data in a particular cell in the result set. Possible values:
  • 0 - (default) A cell in a result set that contains a value calculated by dividing by zero will be returned as an error.
  • 1 - A cell in a result set that contains a value calculated by dividing by zero will be returned as a NULL value. No error will be returned.
2106 both An alternative to using the COMPRESSION connection string keyword. This is an unsigned integer value. Possible values:
  • 0 = compression off
  • 1 = compression on
2109 set An unsigned value specifying whether or not to trim trailing spaces from data returned from CHAR fields. This will make CHAR fields appear like VARCHAR fields as VARCHAR fields are always trimmed of trailing spaces. Possible values:
  • 0 - (default) - don't trim CHAR fields
  • 1 - trim CHAR fields
2110 get Returns a character string containing information about the prestart job that the ODBC connection is using. The information is returned as a string with the following format:
  • 10 character job name,
  • 10 character user,
  • 6 character job
Start of change2116End of change Start of changesetEnd of change Start of changeA pointer to a buffer containing the IBM® Enterprise Workload Manager (eWLM) correlator. Specifying this attribute allows you to tie your application with the eWLM support (Enterprise Workload Manager). End of change
2140 both An unsigned integer value that specifies the amount of time (in seconds) that a distributed transaction waits before timing out. A value of 0 indicates to wait indefinitely for the transaction to finish. Setting this overrides any value that was set for the XATIMEOUT connection string keyword. The default value for this attribute is 0.
2141 both An unsigned integer value that specifies the maximum amount of time (in seconds) that a distributed transaction waits on a lock request before timing out. A value of 0 indicates to use the default system settings. Setting this overrides any value that was set for the XALOCKTIMEOUT connection string keyword. The default value for this attribute is 0.
2142 both An integer value that specifies the RMID to use for XA transaction work. This can be set at anytime. The RMID that is set must be unique for the process. If this value is set to 0 it indicates that any current XA transaction work has been completed for this connection. The default value for this attribute is 0.
2143 get A character string that identifies the iSeries Access driver to call into for XA calls. This string is only valid if the 2142 connection attribute has been set. This string is set after the connection is established. The default value for this attribute is an empty-string.
Table 2. Customized statement attributes
Attribute Get/Set Description
1014 get Returns an unsigned integer value indicating how many result sets are available to be fetched. This is useful when a stored procedure has been called and an application wants to know how many result sets the stored procedure generated.
2106 both Allows compression to be turned on an off at the statement level. Possible values are:
  • 0 = compression off,
  • 1 = compression on
2114 get Returns an unsigned integer value that indicates the offset into a SQL statement at which a SQL syntax error has occurred. This will be set when SQLExecute or SQLExecDirect returns an SQL_ERROR return code.