Connection and statement attributes

The IBM® i Access ODBC specification defines several connection and statement attributes.

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

Start of change
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.
1281 both Specifies the Client User ID string that is sent to the host database. This attribute is set after connected to a database. The maximum length is 255 characters. As an alternative, the CLIENTUSERID connection string keyword is used.
1282 both Specifies the Work Station Name string that is sent to the host database. The maximum length is 255 characters. The attribute is set after connected to a database. As an alternative, the CLIENTWRKSTNNAME connection string keyword is used.
1283 both Specifies the Application Name string using the ODBC driver. The maximum length for this attribute is 255 characters. This attribute is set after connected to a database. As an alternative, the CLIENTAPPLNAME connection string keyword is used.
1284 both Specifies the Accounting ID string that is sent to the host database. The maximum length is 255 characters. This attribute is set after connected to the host database. As an alternative, the CLIENTACCTSTR connection string keyword is used.
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 = (default) 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
2116 set A 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).
2117 both Can be used as an alternative to the CONCURRENTACCESSRESOLUTION connection string keyword. This is an unsigned integer value which controls how conflicting row locks encountered in the transaction should be handled. Note: This property only applies to read-only queries with isolation level CS.
  • 0 - (default) Use server setting
  • 1 - Use Currently Committed Rows
  • 2 - Wait for Outcome
  • 3 - Skip Locks
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 IBM i 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.
2145 both Can be used as an alternative to the XMLDECLARATION connection string keyword. This is an unsigned integer value that is used to indicate what type of XML declaration should be included with XML columns returned in result sets. Here are the values and the meanings:
  • 0 - No declarations or byte order marks (BOMs) are added to the output buffer.
  • 1 -A byte order mark (BOM) in the appropriate endianness is prepended to the output buffer if the target encoding is UTF-16.
  • 2 - A minimal XML declaration is generated, containing only the XML version.
  • 4 - An encoding attribute that identifies the target encoding is added to any generated XML declaration. Therefore, this setting only has effect when the setting of 2 is also included when computing the value of this attribute.
  • 7 -An encoding attribute that indicates that a BOM and an XML declaration containing the XML version and encoding attribute are generated during implicit serialization.
2146 both Can be used as an alternative to the XMLSTRIPWS connection string keyword. This is an unsigned integer value that indicates how whitespace in serialized XML data should be handled by DB2® when the data is implicitly parsed without validation. indicates whether whitespace should be included or stripped from with the following possible values:
  • 0 - STRIP WHITESPACE
  • 1 - PRESERVE WHITESPACE
2511 both Specifies the Program ID string that is sent to the host database. The maximum size is 255 characters. The attribute is set after connected to a database. As an alternative, the CLIENTPROGRAMID connection string keyword is used.
End of change
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.