Connection attributes (CLI) list

You can set the CLI and ODBC driver attributes that are specific to a connection handle with the SQLSetConnectAttr() function. The current connection attribute value is obtained with the SQLGetConnectAttr() function. Some connection attributes are specific to the CLI driver.

The following table indicates when each of the CLI connection attributes can be set.


Table 1. When connection attributes can be set
Attribute Before connection After connection After statements allocated
SQL_ATTR_ACCESS_MODE Yes Yes Yes a
SQL_ATTR_ALLOW_INTERLEAVED_GETDATA Yes Yes Yes
SQL_ATTR_ANSI_APP Yes No No
SQL_ATTR_APP_USES_LOB_LOCATOR Yes Yes Yesc
SQL_ATTR_APPEND_FOR_FETCH_ONLY Yes Yes No
SQL_ATTR_ASYNC_ENABLE Yes Yes Yesa
SQL_ATTR_AUTO_IPD (read-only) No No No
SQL_ATTR_AUTOCOMMIT Yes Yes Yes b
SQL_ATTR_CACHE_USRLIBL Yes Yes Yes
SQL_ATTR_CLIENT_APPLCOMPAT Yes No No
SQL_ATTR_CLIENT_CODEPAGE Yes No No
SQL_ATTR_COLUMNWISE_MRI Yes Yes Yes a
SQL_ATTR_COMMITONEOF Yes Yes No
SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION No Yes Yes a
SQL_ATTR_CONFIG_KEYWORDS_ARRAY_SIZE (read-only) No Yes Yes
SQL_ATTR_CONFIG_KEYWORDS_MAXLEN (read-only) No Yes Yes
SQL_ATTR_CONN_CONTEXT Yes No No
SQL_ATTR_CONNECT_NODE Yes No No
SQL_ATTR_CONNECT_PASSIVE Yes No No
SQL_ATTR_CONNECTION_DEAD (read-only) No No No
SQL_ATTR_CONNECTTYPE Yes No No
SQL_ATTR_CURRENT_CATALOG (read-only) No No No
SQL_ATTR_CURRENT_IMPLICIT_XMLPARSE_OPTION Yes Yes Yes
SQL_ATTR_CURRENT_PACKAGE_PATH Yes Yes Yes
SQL_ATTR_CURRENT_PACKAGE_SET Yes Yes a No *
SQL_ATTR_CURRENT_SCHEMA Yes Yes Yes
SQL_ATTR_DATE_FMT Yes Yes Yes
SQL_ATTR_DATE_SEP Yes Yes Yes
SQL_ATTR_DB2_APPLICATION_HANDLE (read-only) No No No
SQL_ATTR_DB2_APPLICATION_ID (read-only) No No No
SQL_ATTR_DB2_SQLERRP (read-only) No No No
SQL_ATTR_DB2EXPLAIN No Yes Yes
SQL_ATTR_DBC_SYS_NAMING Yes Yes Yes
SQL_ATTR_DECFLOAT_ROUNDING_MODE Yes Yes Yes
SQL_ATTR_DECIMAL_SEP Yes Yes Yes
SQL_ATTR_DESCRIBE_CALL Yes Yes Yesa
SQL_ATTR_DESCRIBE_OUTPUT_LEVEL Yes Yes No
SQL_ATTR_DETECT_READ_ONLY_TXN No Yes Yes
SQL_ATTR_ENLIST_IN_DTC No Yes Yes
SQL_ATTR_EXTENDED_INDICATORS No Yes Yes
SQL_ATTR_FET_BUF_SIZE Yes No No
SQL_ATTR_FORCE_ROLLBACK Yes Yes Yes
SQL_ATTR_FREE_LOCATORS_ON_FETCH Yes Yes Yes
SQL_ATTR_FREE_MEMORY_ON_STMTCLOSE Yes Yes Yes
SQL_ATTR_GET_LATEST_MEMBER No No No
SQL_ATTR_GET_LATEST_MEMBER_NAME No No No
SQL_ATTR_INFO_ACCTSTR No Yes Yes
SQL_ATTR_INFO_APPLNAME No Yes Yes
SQL_ATTR_INFO_PROGRAMID No Yes Yes a
SQL_ATTR_INFO_PROGRAMNAME Yes No No
SQL_ATTR_INFO_CRRTKN Yes Yes Yes
SQL_ATTR_INFO_USERID No Yes Yes
SQL_ATTR_INFO_WRKSTNNAME No Yes Yes
SQL_ATTR_KEEP_DYNAMIC No Yes Yes
SQL_ATTR_LOB_CACHE_SIZE Yes Yes Yesc
SQL_ATTR_LOB_FILE_TRESHOLD
Attention: This feature is available in Db2® 11.5.4 and later versions.

Yes

Yes

Yes
SQL_ATTR_LOGIN_TIMEOUT Yes No No
SQL_ATTR_LONGDATA_COMPAT Yes Yes Yes
SQL_ATTR_MAPCHAR Yes Yes Yes
SQL_ATTR_MAXBLKEXT Yes Yes Yes
SQL_ATTR_MAX_LOB_BLOCK_SIZE Yes Yes Yesc
SQL_ATTR_NETWORK_STATISTICS Yes Yes Yes
SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE No Yes No
SQL_ATTR_OVERRIDE_CODEPAGE No Yes No
SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY No Yes Yes
SQL_ATTR_PARC_BATCH Yes Yes Yes*
SQL_ATTR_PING_DB (read only) No No No
SQL_ATTR_PING_NTIMES Yes Yes Yes
SQL_ATTR_PING_REQUEST_PACKET_SIZE Yes Yes Yes
SQL_ATTR_QUERY_PREFETCH
Important: This feature is available in Db2 11.5.6 and later versions.
Yes Yes Yes
SQL_ATTR_QUIET_MODE Yes Yes Yes
SQL_ATTR_READ_ONLY_CONNECTION Yes No No
SQL_ATTR_RECEIVE_TIMEOUT Yes Yes Yes
SQL_ATTR_REOPT No Yes Yesc
SQL_ATTR_REPORT_ISLONG_FOR_LONGTYPES_OLEDB Yes Yes Yes
SQL_ATTR_REPORT_SEAMLESSFAILOVER_WARNING Yes Yes Yes*
SQL_ATTR_REPORT_TIMESTAMP_TRUNC_AS_WARN Yes Yes Yes
SQL_ATTR_RETRY_ON_MERGE Yes Yes Yes
SQL_ATTR_RETRYONERROR Yes Yes Yes
SQL_ATTR_SERVER_MSGTXT_MASK Yes Yes Yes
SQL_ATTR_SERVER_MSGTXT_SP Yes Yes Yes
SQL_ATTR_SESSION_GLOBAL_VAR Yes Yes Yes
SQL_ATTR_SESSION_TIME_ZONE Yes No No
SQL_ATTR_SPECIAL_REGISTER Yes Yes Yes
SQL_ATTR_SQLCOLUMNS_SORT_BY_ORDINAL_OLEDB Yes Yes Yes
SQL_ATTR_STMT_CONCENTRATOR Yes Yes Yes
SQL_ATTR_STREAM_GETDATA Yes Yes Yesc
SQL_ATTR_STREAM_OUTPUTLOB_ON_CALL Yes Yes No
SQL_ATTR_TIME_FMT Yes Yes Yes
SQL_ATTR_TIME_SEP Yes Yes Yes
SQL_ATTR_TRUSTED_CONTEXT_ACCESSTOKEN
Important: This feature is available in Db2 11.5.4 and later versions.
No Yes Yes
SQL_ATTR_TRUSTED_CONTEXT_PASSWORD No Yes Yes
SQL_ATTR_TRUSTED_CONTEXT_USERID No Yes Yes
SQL_ATTR_TXN_ISOLATION No Yes b Yes a
SQL_ATTR_USE_TRUSTED_CONTEXT Yes No No
SQL_ATTR_USER_REGISTRY_NAME Yes Yes Yes
SQL_ATTR_WCHARTYPE Yes Yes b Yes b
SQL_ATTR_XML_DECLARATION Yes Yes Yes a
SQL_ATTR_IGNORE_SERVER_LIST Yes No No
a
Will only affect subsequently allocated statements.
b
Attribute can be set only if there are no open transactions on the connection.
c
Attribute can be set only if there are no open cursors on the connection. The attribute will affect all statements.
*
Setting this attribute after statements have been allocated will not result in an error, however, determining which packages are used by which statements is ambiguous and unexpected behavior might occur. It is not recommended that you set this attribute after statements have been allocated.

Connection attributes
The connection attribute is specified in the ValuePtr argument of the SQLSetConnectAttr() function.
SQL_ATTR_ACCESS_MODE
A 32-bit integer value which can be either SQL_MODE_READ_ONLY or SQL_MODE_READ_WRITE:
  • SQL_MODE_READ_ONLY: Indicates that an application intends to perform read operations on data. Therefore, a less restrictive isolation level and locking such as uncommitted read (SQL_TXN_READ_UNCOMMITTED) can be used on transactions. The CLI driver does not ensure that requests to the database are read-only. If an update request is issued, the CLI driver process the update request with the transaction isolation level that is selected as a result of the SQL_MODE_READ_ONLY setting.
  • SQL_MODE_READ_WRITE (default): Indicates that an application intends to modify data. The CLI driver uses the default transaction isolation level for the connection where the SQL_MODE_READ_WRITE attribute is specified.

There must not be any outstanding transactions on a connection where the SQL_ATTR_ACCESS_MODE attribute was specified.

SQL_ATTR_ALLOW_INTERLEAVED_GETDATA
The SQL_ATTR_ALLOW_INTERLEAVED_GETDATA attribute only affects connections to database servers that support Dynamic Data Format, also known as progressive streaming.

Specifies whether an application can call the SQLGetData() function for the previously accessed LOB columns and maintain the data offset position from the previous call to the SQLGetData() function. when querying data servers that support Dynamic Data Format.

The SQL_ATTR_ALLOW_INTERLEAVED_GETDATA attribute can have one of the following values:
  • SQL_ALLOW_INTERLEAVED_GETDATA_OFF (default): Specify that an application does not intend to call the SQLGetData() function for the previously accessed LOB columns.
  • SQL_ALLOW_INTERLEAVED_GETDATA_ON: Specify that an application intend to call SQLGetData() for previously accessed LOB columns and reads LOB data from where an application stopped reading during the previous read.

Setting the AllowInterleavedGetData CLI/ODBC configuration keyword is an alternative method to specifying the SQL_ATTR_ALLOW_INTERLEAVED_GETDATA attribute.

SQL_ATTR_ANSI_APP
A 32-bit unsigned integer that identifies an application as an ANSI or Unicode application. The SQL_ATTR_ANSI_APP attribute has one of the following values:
  • SQL_AA_TRUE (default): Specify that an application is an ANSI application. All character data that is passed to and from an application is in the client code page with the ANSI version of the CLI/ODBC functions.
  • SQL_AA_FALSE: Specify that an application is a Unicode application. All character data that is passed to and from an application is in Unicode when the Unicode (W) versions of the CLI/ODBC functions are called.
SQL_ATTR_APP_USES_LOB_LOCATOR
The SQL_ATTR_APP_USES_LOB_LOCATOR attribute indicates whether the LOB locators are used by an application. The SQL_ATTR_APP_USES_LOB_LOCATOR attribute can have one of the following values:
  • 1 (default): Indicates use of the LOB locators.
  • 0: Indicates that the LOB locators are not used. If the application is querying a server that supports the Dynamic Data Format feature, also known as progressive streaming, the 0 value can be specified to stream the data and avoid use of the LOB locators.

The SQL_ATTR_APP_USES_LOB_LOCATOR attribute is ignored for stored procedure result sets.

If the SQL_ATTR_APP_USES_LOB_LOCATOR attribute is set to 0 and an application binds a LOB locator to a result set with the SQLBindCol() function, an Invalid conversion error is returned by the SQLFetch() function.

Setting the AppUsesLOBLocator CLI/ODBC and IBM data server driver configuration keyword is an alternative method for indicating the use of the LOB locators.

SQL_ATTR_APPEND_FOR_FETCH_ONLY

The SQL_ATTR_APPEND_FOR_FETCH_ONLY attribute allows an application to specify when the CLI driver appends the "FOR FETCH ONLY" clause. For example, if the CLI packages are bound with BLOCKING UNAMBIG option, application can specify 0 value for the SQL_ATTR_APPEND_FOR_FETCH_ONLY attribute to prevent cursor blocking or specify 1 to allow cursor blocking.

The SQL_ATTR_APPEND_FOR_FETCH_ONLY attribute can have one of the following values:
  • 0: The CLI driver never appends the "FOR FETCH ONLY" clause to SELECT statements regardless of the server type it is connecting to.
  • 1: The CLI driver always appends the "FOR FETCH ONLY" clause to SELECT statements regardless of the server type it is connecting to.
By default, the CLI driver appends the "FOR FETCH ONLY" clause to SELECT statements when connected to the Db2 for z/OS® servers or the IBM® Db2 for IBM i (Db2 for IBM i) servers.

The SQL_ATTR_APPEND_FOR_FETCH_ONLY can be set either before a connection is allocated or immediately after a connection is established. Application can query the SQL_ATTR_APPEND_FOR_FETCH_ONLY attribute with the SQLGetConnectAttr() function after connection is established or after the SQL_ATTR_APPEND_FOR_FETCH_ONLY attribute is set.

Setting the AppendForFetchOnly CLI/ODBC and IBM data server driver configuration keyword is an alternative method to specify when the CLI driver appends the "FOR FETCH ONLY" clause.

SQL_ATTR_ASYNC_ENABLE
A 32-bit integer value that specifies whether the execution of statements on the specified connection is asynchronous:
  • SQL_ASYNC_ENABLE_OFF (default): Disables the asynchronous statement execution.
  • SQL_ASYNC_ENABLE_ON: Enables the asynchronous statement execution.
Setting the SQL_ASYNC_ENABLE_ON value enables asynchronous execution of statements across all statement handles on a connection where the SQL_ASYNC_ENABLE_ON value is specified. An error is returned if asynchronous execution is turned on while there is an active statement on the connection.

This attribute can be set when the SQLGetInfo() function that is called with the SQL_ASYNC_MODE (for the InfoType argument) value returns SQL_AM_CONNECTION or SQL_AM_STATEMENT.

When a function is called asynchronously in a statement, only the following functions can be issued in the same statement handle for the connection where the SQL_ASYNC_ENABLE_ON value is set:
  • Original function that is currently running.
  • The SQLAllocHandle() function.
  • The SQLCancel() function.
  • The SQLGetDiagField() function.
  • The SQLGetDiagRec() function.
Any other function calls on the same statement handle returns SQL_ERROR with an SQLSTATE of HY010 (Function sequence error). If the original function is issued again on the same statement handle while it is still running, the original function returns the SQL_STILL_EXECUTING value.
The following functions can be issued asynchronously:
  • SQLBulkOperations()
  • SQLColAttribute()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLDescribeCol()
  • SQLDescribeParam()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLExtendedPrepare()
  • SQLFetch()
  • SQLFetchScroll()
  • SQLForeignKeys()
  • SQLGetData()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLMoreResults()
  • SQLNumResultCols()
  • SQLParamData()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLRowCount()
  • SQLSetPos()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTablePrivileges()
  • SQLTables()
Note: Unicode equivalent functions can also be called asynchronously.
SQL_ATTR_AUTO_IPD
A read-only 32-bit unsigned integer value that specifies whether automatic population of the IPD after a call to SQLPrepare() is supported:
  • SQL_TRUE = Automatic population of the IPD after a call to SQLPrepare() is supported by the server.
  • SQL_FALSE = Automatic population of the IPD after a call to SQLPrepare() is not supported by the server. Servers that do not support prepared statements will not be able to populate the IPD automatically.

If SQL_TRUE is returned for the SQL_ATTR_AUTO_IPD connection attribute, the statement attribute SQL_ATTR_ENABLE_AUTO_IPD can be set to turn automatic population of the IPD on or off. If SQL_ATTR_AUTO_IPD is SQL_FALSE, SQL_ATTR_ENABLE_AUTO_IPD cannot be set to SQL_TRUE.

The default value of SQL_ATTR_ENABLE_AUTO_IPD is equal to the value of SQL_ATTR_AUTO_IPD.

This connection attribute can be returned by SQLGetConnectAttr(), but cannot be set by SQLSetConnectAttr().

SQL_ATTR_AUTOCOMMIT
A 32-bit unsigned integer value that specifies whether autocommit mode is enabled. Values are as follows:
  • SQL_AUTOCOMMIT_OFF: Autocommit mode is disabled. An application must explicitly commit or roll back transactions by using SQLEndTran() function calls.
  • SQL_AUTOCOMMIT_ON (default): Autocommit mode is enabled. The CLI driver operates in autocommit mode by default. Each SQL statement is implicitly committed. Each statement that is not a query is committed immediately after successful statement execution or rolled back if a failure occurs. Each query is committed immediately after the associated cursor is closed.

    For a coordinated distributed unit of work (XA) connection, the default is SQL_AUTOCOMMIT_OFF.

  • SQL_AUTOCOMMIT_DEFERRED: Autocommit mode is enabled, but the COMMIT statement is not sent immediately. Autocommit mode is enabled for subsequent SQL statements. If you set the SQL_AUTOCOMMIT_DEFERRED value, the first subsequent SQL statement is treated as a part of the current transaction.

When the SQL_AUTOCOMMIT_ON value is set, the CLI driver issues a COMMIT statement immediately and autocommit mode is enabled for subsequent SQL statements. Sending the implicit COMMIT statement separately to the database server after each SQL statement execution with the SQL_AUTOCOMMIT_ON setting can negatively impact your application performance.

However, the SQL_AUTOCOMMIT_DEFERRED setting causes the CLI driver to chain a COMMIT statement to the next SQL statement that is issued by the application. Therefore, the COMMIT statement is not sent separately to the database server, and the negative impact on your application performance is avoided. The database server resources are not released until the execution of the subsequent SQL statement is complete.
Important: The behavior of the SQL_AUTOCOMMIT_DEFERRED setting is different for the SELECT and CALL statements that return a result set when compared to the SQL_AUTOCOMMIT_ON setting. If you set the SQL_AUTOCOMMIT_DEFERRED value before a SELECT or CALL statement, all previous SQL statements are not committed until the complete result set is returned to the client for the SELECT or CALL statement and the cursor is closed. The SQL_AUTOCOMMIT_DEFERRED setting can improve performance by reducing the network flow. However, if a large amount of data is being manipulated on the server, server resources are locked until subsequent SQL statement is completed.
SQL_ATTR_CACHE_USRLIBL
The SQL_ATTR_CACHE_USRLIBL attribute indicates whether the user library list (*USRLIBL) value is cached or not. The SQL_ATTR_CACHE_USRLIBL attribute can be set to one of the following values:
  • SQL_ATTR_CACHE_USRLIBL_YES (default): Specifies that the *USRLIBL value is cached. When the *USRLIBL value is retrieved from the server, the same *USRLIBL value is used for all catalog function calls in the same connection handle.
  • SQL_ATTR_CACHE_USRLIBL_NO: Specifies that the *USRLIBL value is not cached. When the *USRLIBL value is specified in the schema list, the current *USRLIBL value is retrieved whenever a catalog function call is made. Every catalog function call requires an additional call to the metadata procedure on the database server.
  • SQL_ATTR_CACHE_USRLIBL_REFRESH: Specifies that the current cached *USRLIBL value is removed, causing next call to a catalog function to retrieve the current *USRLIBL value, which is then cached.

The SQL_ATTR_CACHE_USRLIBL attribute is valid only for use with the Db2 for IBM i server.

SQL_ATTR_CLIENT_APPLCOMPAT
Enables new Db2 for z/OS version 12 features such as XA support for multi transport models, maintaining session data on the server, and caching statements on rollback if set to "V12R1". If set to any different value, these new features will not be enabled. Starting from 11.1.1.1 onwards, the keyword will accept valid values as in "V12R1M501" or "V12R1M502", for example.
SQL_ATTR_CLIENT_CODEPAGE
A connection level attribute value that enables the user to specify connection level code page from the CLI application. Specifying this attribute will override any environment level default code page setting:

Example 1: Setting the code page to be used by this database connection

Unicode = 1208;
cliRC = SQLSetConnectAttr(hdbc,
                          SQL_ATTR_CLIENT_CODEPAGE, 
                          (SQLPOINTER)&unicode,  SQL_NTS);  
char *connStr = "DSN=EBCDICDB;"; 
cliRC = SQLDriverConnect (hdbc, (SQLHWND)NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);

Example 2: Getting the current value of SQL_ATTR_CLIENT_CODEPAGE

cliRC = SQLConnect(hdbc,
                       (SQLCHAR *)"SAMPLE",
                        SQL_NTS,
                       (SQLCHAR *)"USER1",
                       SQL_NTS,
                       (SQLCHAR *)"PASSWD1",
                       SQL_NTS);

cliRC = SQLGetConnectAttr(hdbc, 
                      SQL_ATTR_CLIENT_CODEPAGE,
                      &codePage, 0, NULL);
SQL_ATTR_CLIENT_LOB_BUFFERING
Specifies whether LOB locators or the underlying LOB data is returned in a result set for LOB columns that are not bound. By default, locators are returned. If an application usually fetches unbound LOBs and then must retrieve the underlying LOB data, the application's performance can be improved by retrieving the LOB data from the outset; this reduces the number of synchronous waits and network flows. The possible values for this attribute are:
  • SQL_CLIENTLOB_USE_LOCATORS (default) - LOB locators are returned
  • SQL_CLIENTLOB_BUFFER_UNBOUND_LOBS - actual LOB data is returned
SQL_ATTR_CLIENT_TIME_ZONE
A null-terminated character string in the format ±hh:mm, containing the Time Zone information. Specifying this attribute will override the default Operating System Time Zone value of Client host.
SQL_ATTR_COLUMNWISE_MRI
A 32-bit unsigned integer that enables CLI applications that are connected to the Db2 for z/OS servers to convert array input chaining into column-wise array input for INSERT and MERGE operations. The possible values for the SQL_ATTR_COLUMNWISE_MRI attribute are SQL_COLUMNWISE_MRI_OFF and SQL_COLUMNWISE_MRI_ON:
  • SQL_COLUMNWISE_MRI_OFF (default): The CLI driver does not convert chaining data to column-wise array input.
  • SQL_COLUMNWISE_MRI_ON: The CLI driver converts array input chaining to column-wise array input. The Multi-Row Insert (MRI) feature inDb2 for z/OS expects data to be in column-wise array form. If your application uses array input chaining, this conversion helps you optimize your application performance because data is sent in a compact array form each time you call SQLExecute (). For more information about array input chaining, see SQL_ATTR_CHAINING_BEGIN.

The SQL_ATTR_COLUMNWISE_MRI attribute can be specified for use with Db2 for z/OS servers. For connection to servers other than Db2 for z/OS, the CLI driver automatically converts chaining data to row-wise array input.

The conversion is not performed in the following cases:
  • Bind parameters with a LOB data type such as SQL_CLOB, SQL_BLOB, SQL_LONGVARBINARY, SQL_LONGVARGRAPHIC, SQL_DBCLOB, or SQL_XML.
  • If a parameter is bound with the SQL_DATA_AT_EXEC argument in a MERGE or INSERT operation, which require calls to the SQLPutData() and SQLParamData() functions.
  • Space to store all the application data in the internal buffers is not available.
SQL_ATTR_COMMITONEOF
The SQL_ATTR_COMMITONEOF attribute specifies whether the implicit COMMIT statement is issued by the CLI driver immediately following the retrieval of the entire result set and the EOF marker. The SQL_ATTR_COMMITONEOF attribute can have one of the following values
  • SQL_COMMITONEOF_ON: The implicit COMMIT statement is issued following the retrieval of the entire result set and the EOF marker. The SQL_COMMITONEOF_ON value is the default only when you are connecting to Db2 for z/OS Version 9 and later servers.
  • SQL_COMMITONEOF_OFF: The COMMIT statement is not implicitly issued following the retrieval of the entire result set and the EOF marker. You must explicitly call the SQLFreeStmt() function to close the cursor and release resources. The SQL_COMMITONEOF_OFF value is the default when you are connecting to database servers other than Db2 for z/OS 9, or version newer than Version 9.
You must ensure that the following conditions are satisfied to enable the SQL_COMMITONEOF_ON attribute:
  • The autocommit mode is enabled.
  • The cursor is read-only and forward-only.
  • The SQL_ATTR_EARLYCLOSE statement attribute is set to SQL_EARLYCLOSE_ON (default).
When you are connecting to the Db2 for z/OS Version 9 and later servers, the default value is SQL_COMMITONEOF_ON. If an application explicitly set the SQL_EARLYCLOSE_OFF statement attribute but does not specify the SQL_COMMITONEOF_ON connection attribute, the CLI driver silently changes the connection attribute to the SQL_ COMMITONEOF_OFF value on connection to the Db2 for z/OS Version 9 and later servers. However, the CLI0126E error is returned if an application explicitly sets following attributes together:
  • The SQL_ATTR_COMMITONEOF statement attribute to SQL_COMMITONEOF_ON.
  • The SQL_ATTR_EARLYCLOSE statement attribute to SQL_EARLYCLOSE_OFF.
Note: Usage of this attribute does not replace the requirement to call the SQLFreeStmt() function.
SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION
A 32-bit integer value that specifies the concurrent access resolution to use at the statement level. The SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION attribute setting overrides the default behavior that is specified for cursor stability (CS) scans.
  • 0: No setting. The client does not supply a prepare option.
  • 1: Use the currently committed semantics. On every prepared statement, the CLI driver specifies the currently committed semantics. The value indicates that the database manager uses the currently committed version of the data for applicable scans when the data is updated or deleted. The uncommitted inserted rows are skipped. The setting value of 1 applies when the isolation level is cursor stability or read stability (for read stability it skips uncommitted inserts only) and is ignored otherwise. Applicable scans include read-only scans that can be part of a read-only statement or a non read-only statement. The settings for the registry variables DB2_EVALUNCOMMITTED, DB2_SKIPDELETED, and DB2_SKIPINSERTED do not apply to scans with the currently committed semantics. However, the settings for these registry variables still apply to scans that do not use the currently committed semantics.
  • 2: Wait for outcome. On every prepared statement, the CLI driver specifies the wait for outcome clause. The cursor stability and higher isolation level scans wait for the commit or rollback when the data is updated or deleted. Rows that are being inserted are not skipped. The settings for the registry variables DB2_EVALUNCOMMITTED, DB2_SKIPDELETED, and DB2_SKIPINSERTED no longer apply.
  • 3: Skip locked data. On every prepared statement, the CLI driver specifies the skip locked data clause. The currently committed semantics are used and rows that are being inserted are skipped. The option 3 is not supported on Db2 servers. If specified, the option 3 setting is ignored.

For Db2 servers, use the SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION attribute to override the default behavior for currently committed that is defined by the cur_commit configuration parameter. For Db2 for z/OS servers, use the SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION attribute to enable currently committed behavior. There is no equivalent database configuration parameter available on Db2 for z/OS server for specifying this behavior.

Db2 for IBM i V6R1 server supports only the options 0 and 2. Db2 for IBM i V7R1 and later servers supports all available options for the SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION attribute.

Setting the ConcurrentAccessResolution CLI/ODBC configuration keyword is an alternative method of specifying this behavior.

SQL_ATTR_CONFIG_KEYWORDS_ARRAY_SIZE
A read only integer value that indicates the total number of all the configuration keywords that are set by the application. The SQL_ATTR_CONFIG_KEYWORDS_ARRAY_SIZE and SQL_ATTR_CONFIG_KEYWORDS_MAXLEN attribute values are required to determine the maximum size of the buffer (BufferLength) that is required to call the SQLGetInfo() function with the SQL_CONFIG_KEYWORDS argument (InfoType).
SQL_ATTR_CONFIG_KEYWORDS_MAXLEN
A read only integer value that indicates the maximum length of all the configuration keyword value pairs that are set by the application. The SQL_ATTR_CONFIG_KEYWORDS_ARRAY_SIZE and SQL_ATTR_CONFIG_KEYWORDS_MAXLEN attribute values are required to determine the maximum size of the buffer (BufferLength) that is required to call the SQLGetInfo() function with the SQL_CONFIG_KEYWORDS argument (InfoType).
SQL_ATTR_CONN_CONTEXT
Indicates which context the connection should use. An SQLPOINTER to either:
  • a valid context (allocated by the sqleBeginCtx() Db2 API) to set the context
  • a NULL pointer to reset the context

This attribute can only be used when the application is using the Db2 context APIs to manage multi-threaded applications. By default, CLI manages contexts by allocating one context per connection handle, and ensuring that any executing thread is attached to the correct context.

For more information about contexts, refer to the sqleBeginCtx() API.

This attribute is not supported when accessing the Informix® databases.

SQL_ATTR_CONNECT_NODE
A 32-bit integer that specifies the target logical partition of a Db2 Enterprise Server Edition database partition server that you want to connect to. The possible values for this attribute are:
  • An integer between 0 and 999
  • SQL_CONN_CATALOG_NODE

If this variable is not set, the target logical node defaults to the logical node which is defined with port 0 on the machine.

This attribute is not supported when accessing Informix database servers.

There is also a corresponding keyword, the ConnectNode CLI/ODBC and IBM data server driver configuration keyword.

SQL_ATTR_CONNECT_PASSIVE
Allows a passive connection from an application to an already active database. Possible values for this attribute are:
  • SQL_CONNECT_PASSIVE_YES - Establish a passive connection to an active database
  • SQL_CONNECT_PASSIVE_NO - Establish a default type connection to the database. This is the default value. If it is not already active, the database will be activated when establishing the connection.
This attribute can only be used to establish passive connection to an active database. Any attempt to use this attribute on an inactive database results in an error.
SQL_ATTR_CONNECTION_DEAD
A read only 32-bit integer value that indicates whether or not the connection is still active. CLI will return one of the following values:
  • SQL_CD_FALSE - The connection is still active.
  • SQL_CD_TRUE - An error has already happened and caused the connection to the server to be terminated. The application should still perform a disconnect to clean up any CLI resources.

This attribute is used mainly by the Microsoft ODBC Driver Manager 3.5x before pooling the connection.

SQL_ATTR_CONNECTION_TIMEOUT
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_CONNECTTYPE
A 32-bit integer value that specifies whether this application is to operate in a coordinated or uncoordinated distributed environment. The possible values are as follows:
  • SQL_CONCURRENT_TRANS (default): The application can have concurrent multiple connections to any one database or to multiple databases. Each connection has its own commit scope. No effort is made to enforce coordination of transactions. If an application issues a commit using the environment handle on SQLEndTran() and not all of the connections commit successfully, the application is responsible for recovery.
  • SQL_COORDINATED_TRANS: The application can coordinate commit and rollbacks among multiple database connections. This option setting corresponds to the specification of the Type 2 CONNECT in embedded SQL. In contrast to the SQL_CONCURRENT_TRANS setting, the application is allowed only one open connection per database. There is no impact on the full XA behavior when SQL_ATTR_CONNECTTYPE is set to SQL_COORDINATED_TRANS. In other words, the full XA behavior will work without any issues.

    Earlier, XA transaction was supported only on a single transport mode. With the full XA support, XA transaction is supported on dual and multi-transport mode. For example, previously, xa_start followed by xa_end followed by xa_prepare and xa_commit/xa_rollback had to all be done on one transport. Now, xa_start followed by xa_end can be on one transport while xa_prepare and xa_commit/xa_rollback can go on another transport.

    Note: This connection type results in the default for the SQL_ATTR_AUTOCOMMIT connection option to be SQL_AUTOCOMMIT_OFF.

If changing this attribute from the default then it must be set before any connections have been established on the environment handle.

It is recommended that the application set this attribute as an environment attribute with a call to SQLSetEnvAttr(), if necessary, as soon as the environment handle has been allocated. However, since ODBC applications cannot access SQLSetEnvAttr(), they must set this attribute using SQLSetConnectAttr() after each connection handle is allocated, but before any connections have been established.

All connections on an environment handle must have the same SQL_ATTR_CONNECTTYPE setting. An environment cannot have a mixture of concurrent and coordinated connections. The type of the first connection will determine the type of all subsequent connections. SQLSetEnvAttr() will return an error if an application attempts to change the connection type while there is an active connection.

The default connect type can also be set using the ConnectType CLI/ODBC and IBM data server driverconfiguration keyword.

Note: This is an IBM defined attribute.
SQL_ATTR_CURRENT_CATALOG
A null-terminated character string containing the name of the catalog used by the data source. The catalog name is typically the same as the database name.

This connection attribute can be returned by SQLGetConnectAttr(), but cannot be set by SQLSetConnectAttr(). Any attempt to set this attribute will result in an SQLSTATE of HYC00 (Driver not capable).

SQL_ATTR_CURRENT_IMPLICIT_XMLPARSE_OPTION
A null-terminated character string that is the string constant used to set the CURRENT IMPLICIT XMLPARSE OPTION special register. Setting this attribute causes the SET CURRENT IMPLICIT XMLPARSE OPTION SQL statement to be issued. If this attribute is set before a connection has been established, the SET CURRENT IMPLICIT XMLPARSE OPTION SQL statement will be issued when the connection is made.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_CURRENT_PACKAGE_PATH
A null-terminated character string of package qualifiers that the Db2 database server uses to try to resolve the package when multiple packages have been configured. Setting this attribute causes the "SET CURRENT PACKAGE PATH = schema1, schema2, ..." statement to be issued after every connection to the database server.

This attribute is best suited for use with ODBC static processing applications, rather than CLI applications.

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_CURRENT_PACKAGE_SET

A null-terminated character string that indicates the schema name (collection identifier) that is used to select the package for subsequent SQL statements. Setting this attribute causes the SET CURRENT PACKAGESET SQL statement to be issued. If this attribute is set before a connection, the SET CURRENT PACKAGESET SQL statement will be issued at connection time.

CLI/ODBC applications issue dynamic SQL statements. Using this connection attribute, you can control the privileges used to run these statements:
  • Choose a schema to use when running SQL statements from CLI/ODBC applications.
  • Ensure the objects in the schema have the required privileges and then rebind accordingly. This typically means binding the CLI packages (sqllib/bnd/db2cli.lst) using the COLLECTION <collid> option. Refer to the BIND command for further details.
  • Set the CURRENTPACKAGESET option to this schema.
The SQL statements from the CLI/ODBC applications will now run under the specified schema and use the privileges defined there.

Setting the CurrentPackageSet CLI/ODBC configuration keyword is an alternative method of specifying the schema name.

The following package set names are reserved: NULLID, NULLIDR1, NULLIDRA.

SQL_ATTR_REOPT and SQL_ATTR_CURRENT_PACKAGE_SET are mutually exclusive, therefore, if one is set, the other is not allowed.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_CURRENT_SCHEMA
A null-terminated character string containing the name of the schema to be used by CLI for the SQLColumns() call if the szSchemaName pointer is set to null.

To reset this option, specify this option with a zero length string or a null pointer for the ValuePtr argument.

This option is useful when the application developer has coded a generic call to SQLColumns() that does not restrict the result set by schema name, but needs to constrain the result set at isolated places in the code.

This option can be set at any time and will be effective on the next SQLColumns() call where the szSchemaName pointer is null.

Note: The SQL_ATTR_CURRENT_SCHEMA attribute is an IBM defined attribute.
SQL_ATTR_DATE_FMT
The SQL_ATTR_DATE_FMT attribute specifies the date format. The SQL_ATTR_DATE_FMT attribute can be set to one of the following values:
  • SQL_IBMi_FMT_ISO: Specifies the International Standards Organization (ISO) date format of yyyy-mm-dd.
  • SQL_IBMi_FMT_USA: Specifies the United States date format of mm/dd/yyyy.
  • SQL_IBMi_FMT_EUR: Specifies the European date format of dd.mm.yyyy.
  • SQL_IBMi_FMT_JIS: Specifies the Japanese Industrial Standard date format of yyyy-mm-dd.
  • SQL_IBMi_FMT_MDY: Specifies the date format of mm/dd/yy.
  • SQL_IBMi_FMT_DMY: Specifies the date format of dd/mm/yy.
  • SQL_IBMi_FMT_YMD: Specifies the date format of yy/mm/dd.
  • SQL_IBMi_FMT_JUL: Specifies the Julian date format of yy/ddd.
  • SQL_IBMi_FMT_JOB: Specifies the job default for the date format.

The default value for the SQL_ATTR_DATE_FMT attribute is determined by the DATETIME bind option that is specified for packages. If the default DATETIME bind option is specified for the CLI packages, SQL_IBMi_FMT_ISO is the default value for the SQL_ATTR_DATE_FMT attribute

The SQL_ATTR_DATE_FMT attribute is only valid for use with the Db2 for IBM i server.
Note: The SQL_ATTR_DATE_FMT attribute is an IBM defined attribute.
SQL_ATTR_DATE_SEP
The SQL_ATTR_DATE_SEP attribute specifies the date separator. The SQL_ATTR_DATE_SEP attribute can be set to one of the following values:
  • SQL_SEP_SLASH: Specifies a slash ( / ) for the date separator.
  • SQL_SEP_DASH: Specifies a dash ( - ) for the date separator.
  • SQL_SEP_PERIOD: Specifies a period ( . ) for the date separator.
  • SQL_SEP_COMMA: Specifies a comma ( , ) for the date separator.
  • SQL_SEP_BLANK: Specifies a blank for the date separator.
  • SQL_SEP_JOB: Specifies the job default for the date separator.

The default value for the SQL_ATTR_DATE_SEP attribute is determined by the DATETIME bind option that is specified for packages. If the default DATETIME bind option is specified for the CLI packages, SQL_SEP_SLASH is the default value for the SQL_ATTR_DATE_SEP attribute

The SQL_ATTR_DATE_SEP attribute is only valid for use with Db2 for IBM i servers after you set the SQL_ATTR_DATE_FMT attribute to one of the following values:
  • SQL_IBMi_FMT_MDY
  • SQL_IBMi_FMT_DMY
  • SQL_IBMi_FMT_YMD
  • SQL_IBMi_FMT_JUL
Note: The SQL_ATTR_DATE_SEP attribute is an IBM defined attribute.
SQL_ATTR_DB2_APPLICATION_HANDLE
A user-defined character string that returns the application handle of the connection. If the string is not large enough to contain the complete application handle, it will be truncated.

This connection attribute can be returned by SQLGetConnectAttr(), but cannot be set by SQLSetConnectAttr().

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_DB2_APPLICATION_ID
A user-defined character string that returns the application identifier of the connection. If the string is not large enough to contain the complete application identifier, it will be truncated.

This connection attribute can be returned by SQLGetConnectAttr(), but cannot be set by SQLSetConnectAttr().

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_DB2_SQLERRP
An sqlpointer to a null-terminated string containing the sqlerrp field of the sqlca.

Begins with a three-letter identifier indicating the product, followed by five alphanumeric characters indicating the version, release, and modification level of the product. The characters A-Z indicate a modification level higher than 9. A indicates modification level 10, B indicates modification level 11, and so on. For example, SQL0907C means Db2 Version 9 Release 7 Modification level 12.

If SQLCODE indicates an error condition, then this field identifies the module that returned the error.

This field is also used when a successful connection is completed.

Note: This is an IBM defined attribute.
SQL_ATTR_DB2ESTIMATE
This attribute has been deprecated in the Db2 product.
SQL_ATTR_DB2EXPLAIN
A 32-bit integer that specifies whether Explain snapshot, Explain mode information, or both should be generated by the server. Permitted values are:
  • SQL_DB2EXPLAIN_OFF: Both the Explain Snapshot and the Explain table option facilities are disabled (a SET CURRENT EXPLAIN SNAPSHOT=NO and a SET CURRENT EXPLAIN MODE=NO are sent to the server).
  • SQL_DB2EXPLAIN_SNAPSHOT_ON: The Explain Snapshot facility is enabled, and the Explain table option facility is disabled (a SET CURRENT EXPLAIN SNAPSHOT=YES and a SET CURRENT EXPLAIN MODE=NO are sent to the server).
  • SQL_DB2EXPLAIN_MODE_ON: The Explain Snapshot facility is disabled, and the Explain table option facility is enabled (a SET CURRENT EXPLAIN SNAPSHOT=NO and a SET CURRENT EXPLAIN MODE=YES are sent to the server).
  • SQL_DB2EXPLAIN_SNAPSHOT_MODE_ON: Both the Explain Snapshot and the Explain table option facilities are enabled (a SET CURRENT EXPLAIN SNAPSHOT=YES and a SET CURRENT EXPLAIN MODE=YES are sent to the server).

Before the explain information can be generated, the explain tables must be created.

This statement is not under transaction control and is not affected by a ROLLBACK. The new SQL_ATTR_DB2EXPLAIN setting is effective on the next statement preparation for this connection.

The current authorization ID must have INSERT privilege for the Explain tables.

The default value can also be set using the DB2Explain CLI/ODBC configuration keyword.

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_DBC_SYS_NAMING
A 32-bit integer that specifies whether the system naming mode or the SQL naming mode is used when connecting to the Db2 for IBM i V7R1 server and later with PTF SI46944. Possible values are:
  • SQL_TRUE: The Db2 for IBM i system naming mode is used. Files are qualified with the slash (/) delimiter. Unqualified files are resolved with the library list for the job.
  • SQL_FALSE: The SQL naming mode which is the default value. Files are qualified with the period (.) delimiter. Unqualified files are resolved with either the default library or the current user ID.
Example of setting the SQL_ATTR_DBC_SYS_NAMING attribute:
cliRC = SQLSetConnectAttr(hdbc,
                          SQL_ATTR_DBC_SYS_NAMING ,
                          (SQLPOINTER)SQL_TRUE,
                          SQL_NTS);
Note: This is an IBM defined attribute which is only applicable when connecting to the Db2 for IBM i V7R1 server and later with PTF SI46944.
SQL_ATTR_DECFLOAT_ROUNDING_MODE

The decimal float rounding mode determines what type of rounding will be used if a value is put into a DECFLOAT variable or column but the value has more digits than are allowed in the DECFLOAT data type. This can occur when inserting, updating, selecting, converting from another type, or as the result of a mathematical operation.

The value of SQL_ATTR_DECFLOAT_ROUNDING_MODE determines the decimal float rounding mode that will be used for new connections unless another mode is specified by a connection attribute for that connection. For any given connection both CLI and Db2 will use the same decimal float rounding mode for all action initiated as part of that connection.

When your applications are connecting to a Db2 Version 9.5 server, you must set the decimal float rounding mode on the database client to the same mode that is set on the server. If you set the decimal float rounding mode on the client to a value that is different from the decimal float rounding mode that is set on the database server, the database server will return SQL0713N on connection.

The settings correspond to these decimal float rounding modes:

  • 0 = Half even (default)
  • 1 = Half up
  • 2 = Down
  • 3 = Ceiling
  • 4 = Floor

The different modes are:

Half even (default)
In this mode CLI and Db2 use the number that will fit in the target variable and that is closest to the original value. If two numbers are equally close, they use the one that is even. This mode produces the smallest rounding errors over large amounts of data.
Half up
In this mode CLI and Db2 use the number that will fit in the target variable and that is closest to the original value. If two numbers are equally close, they use the one that is greater than the original value.
Down
In this mode CLI and Db2 use the number that will fit in the target variable and that is closest to the original value and for which the absolute value is not greater than the absolute value of the original value. You can also think of this as rounding toward zero or as using ceiling for negative values and using floor for positive values.
Ceiling
In this mode CLI and Db2 use the smallest number that will fit in the target variable and that is greater than or equal to the original value.
Floor
In this mode CLI and Db2 use the largest number that will fit in the target variable and that is less than or equal to the original value.

This attribute is not supported when accessing an Informix database server.

SQL_ATTR_DECIMAL_SEP
The SQL_ATTR_DECIMAL_SEP attribute specifies the decimal separator. The SQL_ATTR_DECIMAL_SEP attribute can be set to one of the following values:
  • SQL_SEP_PERIOD: Specifies a period ( . ) for the decimal separator.
  • SQL_SEP_COMMA: Specifies a comma ( , ) for the decimal separator.
  • SQL_SEP_JOB: Specifies the job default for the decimal separator.

The default value for the SQL_ATTR_DECIMAL_SEP attribute is determined by the DECDEL bind option that is specified for packages. If the default DECDEL bind option is specified for the CLI packages, SQL_SEP_PERIOD is the default value for the SQL_ATTR_DECIMAL_SEP attribute.

The SQL_ATTR_DECIMAL_SEP attribute is only valid for use with the Db2 for IBM i server.
Note: The SQL_ATTR_DECIMAL_SEP attribute is an IBM defined attribute.
SQL_ATTR_DESCRIBE_CALL
A 32-bit integer value that indicates when stored procedure arguments are described. By default, CLI does not request input parameter describe information when it prepares a CALL statement. If an application has correctly bound parameters to a statement, then this describe information is unnecessary and not requesting it improves performance. The option values are:
  • 1 = SQL_DESCRIBE_CALL_BEFORE.
  • -1 = SQL_DESCRIBE_CALL_DEFAULT.

Setting this attribute can be done using the DescribeCall CLI/ODBC and IBM data server driverconfiguration keyword. Refer to the keyword for usage information and descriptions of the available options.

Note: This is an IBM defined attribute.
SQL_ATTR_DESCRIBE_OUTPUT_LEVEL
A null-terminated character string that controls the amount of information the CLI driver requests on a prepare or describe request. By default, when the server receives a describe request, it returns the information contained in level 2 of Table 2 for the result set columns. An application, however, might not need all of this information or might need additional information. Setting the SQL_ATTR_DESCRIBE_OUTPUT_LEVEL attribute to a level that suits the needs of the client application might improve performance because the describe data transferred between the client and server is limited to the minimum amount that the application requires. If the SQL_ATTR_DESCRIBE_OUTPUT_LEVEL setting is set too low, it might impact the functionality of the application (depending on the application's requirements). The CLI functions to retrieve the describe information might not fail in this case, but the information returned might be incomplete. Supported settings for SQL_ATTR_DESCRIBE_OUTPUT_LEVEL are:
  • 0 - no describe information is returned to the client application
  • 1 - describe information categorized in level 1 (see Table 2) is returned to the client application
  • 2 - (default) describe information categorized in level 2 (see Table 2) is returned to the client application
  • 3 - describe information categorized in level 3 (see Table 2) is returned to the client application

The following table lists the fields that form the describe information that the server returns when it receives a prepare or describe request. These fields are grouped into levels, and the SQL_ATTR_DESCRIBE_OUTPUT_LEVEL attribute controls which levels of describe information the CLI driver requests.

Note:
  1. Not all levels of describe information are supported by all Db2 servers. All levels of describe information are supported on the following Db2 servers:
    • Db2
    • Db2 for z/OS Version 8 and later
    • Db2 for IBM i Version 5 Release 3 and later
    All other Db2 servers support only the 2 or 0 setting for the SQL_ATTR_DESCRIBE_OUTPUT_LEVEL attribute.
  2. The default behavior will allow CLI to promote the level to 3 if the application asks for describe information that was not initially retrieved using the default level 2. This might result in two network flows to the server. If an application uses this attribute to explicitly set a describe level, then no promotion will occur. Therefore, if the attribute is used to set the describe level to 2, then CLI will not promote to level 3 even if the application asks for extended information.
Table 2. Levels of describe information
Level 1 Level 2 Level 3
SQL_COLUMN_COUNT
SQL_COLUMN_LENGTH
SQL_COLUMN_NULLABLE
SQL_COLUMN_PRECISION
SQL_COLUMN_SCALE
SQL_DESC_CASE_SENSITIVE
SQL_DESC_CONCISE_TYPE
SQL_DESC_COUNT
SQL_DESC_DISPLAY_SIZE
SQL_DESC_FIXED_PREC_SCALE
SQL_DESC_LENGTH
SQL_DESC_LITERAL_PREFIX
SQL_DESC_LITERAL_SUFFIX
SQL_DESC_NULLABLE
SQL_DESC_OCTET_LENGTH
SQL_DESC_PRECISION
SQL_DESC_SEARCHABLE
SQL_DESC_SCALE
SQL_DESC_TYPE
SQL_DESC_UNSIGNED
all fields of level 1 and:
SQL_COLUMN_NAME
SQL_DESC_DISTINCT_TYPE
SQL_DESC_LABEL
SQL_DESC_LOCAL_TYPE_NAME
SQL_DESC_NAME
SQL_DESC_REFERENCE_TYPE
SQL_DESC_STRUCTURED_TYPE
SQL_DESC_TYPE_NAME
SQL_DESC_UNNAMED
SQL_DESC_USER_DEFINED_
         TYPE_CODE
SQL_DESC_USER_TYPE
all fields of levels 1
and 2 and:
SQL_DESC_AUTO_UNIQUE_VALUE
SQL_DESC_BASE_COLUMN_NAME
SQL_DESC_BASE_TABLE_NAME
SQL_DESC_CATALOG_NAME
SQL_DESC_IDENTITY_VALUE
SQL_DESC_SCHEMA_NAME
SQL_DESC_TABLE_NAME
SQL_DESC_UPDATABLE

Setting the DescribeOutputLevel CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying this behavior.

SQL_ATTR_DETECT_READ_ONLY_TXN
The SQL_ATTR_DETECT_READ_ONLY_TXN attribute specifies whether a connection can be seamlessly fail over to a new member when the automatic client reroute feature is enabled, even if the failed statement is not the first SQL statement in a transaction. This attribute can be specifed when you are connecting to the following servers:
  1. Db2 Version 10.5 Fix Pack 4 and later fix packs.
  2. Db2 for z/OS Version 11 in new function mode (NFM) with the automatic client reroute and Sysplex workload balancing features enabled.
This attribute takes the following values:
  • SQL_DETECT_READ_ONLY_TXN_ENABLE - indicates that a connection can be seamlessly fail over to a new member when the automatic client reroute feature is enabled, even if the failed statement is not the first SQL statement in a transaction. this setting forces the connected server to return the latest values of special registers and session global variables whenever they are modified.
  • SQL_DETECT_READ_ONLY_TXN_DISABLE(default) - disables this feature.
SQL_ATTR_ENLIST_IN_DTC
An SQLPOINTER which can be either of the following values:
  • non-null transaction pointer: The application requests to CLI to change the state of the connection from non-distributed transaction state to distributed state. The connection is enlisted with the Distributed Transaction Coordinator (DTC).
  • null: The application requests to CLI to change the state of the connection from distributed transaction state to a non-distributed transaction state.

This attribute is only used in a Microsoft Transaction Server (MTS) environment to enlist or un-enlist a connection with MTS.

Each time this attribute is used with a non-null transaction pointer, the previous transaction is assumed to be ended and a new transaction is initiated. The application must call the ITransaction member function Endtransaction before calling this API with a non-null pointer. Otherwise the previous transaction will be aborted. The application can enlist multiple connections with the same transaction pointer.
Note: This connection attribute is specified by MTS automatically for each transaction and is not coded by the user application.
It is imperative for CLI/ODBC applications that there will be no concurrent SQL statements executing on 2 different connections into the same database that are enlisted in the same transaction.
SQL_ATTR_EXTENDED_INDICATORS
A 32-bit integer that allows users to use the extended indicator feature from the supported server. If the user attempts to set this attribute against the data server which does not support extended indicators, an appropriate error is returned to the CLI application. This attribute can take the following value:
  • SQL_EXTENDED_INDICATOR_ENABLE: Enables users to specify values to signify SQL_UNASSIGNED and SQL_DEFAULT_PARAM on the SQLBindParameter() / SQLExtendedBind() methods.
  • SQL_EXTENDED_INDICATOR_NOT_SET (default): This feature is disabled by default. The user gets an InvalidArgument value error, CLI0124E, if the SQL_UNASSIGNED and SQL_DEFAULT_PARAM are used before enabling this feature using SQL_ATTR_EXTENDED_INDICATORS.
  • Extended indicators support is supported on following IBM Data Server products:
    • The Db2 database server.
    • The Db2 for z/OS Version 10 server.
    • The Db2 for IBM i V7.1 data servers server.
SQL_ATTR_FET_BUF_SIZE
A connection level attribute to allow applications to set the default query block size to an optimum value in range of 64K-10208K. This attribute should be set before a connection is made. CLI will also provide a db2cli.ini level keyword, FET_BUF_SIZE, which can be set in db2cli.ini file and connection string.
An equivalent db2dsdriver.cfg keyword, FetchBufferSize is also available, which can be set in the db2dsdriver.cfg file.
Note: This attribute should be specified in bytes. For example, specify 10208K as 10452992.
SQL_ATTR_FORCE_ROLLBACK
A 32-bit unsigned integer value that allows calls to the SQLEndTran() function in a data-at-execution flow for connections to Db2 for z/OS servers.

To call the SQLEndTran() function specifying SQL_ROLLBACK as CompletionType in your applications during a data-at-execution flow, the StreamPutData configuration keyword must be set to 1, and the SQL_ATTR_FORCE_ROLLBACK connection attribute must also be set.

The CLI0150E error message is returned for connections to database servers that are not Db2 for z/OS servers.

Note: This is an IBM defined attribute.
SQL_ATTR_FREE_LOCATORS_ON_FETCH
A boolean attribute that specifies if LOB locators are freed when SQLFetch() is executed, rather than when a COMMIT is issued. Setting this attribute to 1 (true) frees the locators that are used internally when applications fetch LOB data without binding the LOB columns with SQLBindCol() (or equivalent descriptor APIs). Locators that are explicitly returned to the application must still be freed by the application. This attribute value can be used to avoid scenarios where an application receives SQLCODE = -429 (no more locators). The default for this attribute is 0 (false).
Note: This is an IBM defined attribute.
SQL_ATTR_FREE_MEMORY_ON_STMTCLOSE
A connection level attribute that specifies whether the SQL_CLOSE action that is specified with the SQLFreeStmt() function frees large memory allocation by the CLI driver. The CLI driver allocates large memory under the following scenarios:
  • When client fetches the LOB columns from a server that does not support the Dynamic Data Format feature.
  • When client calls the SQLGetData() function with AllowInterleavedGetData keyword set.
The SQL_ATTR_FREE_MEMORY_ON_STMTCLOSE attribute can be set to the following value:
  • SQL_FREE_MEMORY_ON_STMTCLOSE_NO: The default value. The memory allocation by the CLI driver for specified scenario is not freed when SQL_CLOSE action takes place.
  • SQL_FREE_MEMORY_ON_STMTCLOSE_YES: The memory allocation by the CLI driver for specified scenario is freed when SQL_CLOSE action takes place.
Example of setting the SQL_ATTR_FREE_MEMORY_ON_STMTCLOSE attribute:
cliRC = SQLSetConnectAttr(hdbc,
                          SQL_ATTR_FREE_MEMORY_ON_STMTCLOSE ,
                          (SQLPOINTER)SQL_FREE_MEMORY_ON_STMTCLOSE_YES,
                          SQL_IS_INTEGER);
Note: This is an IBM defined attribute.
SQL_ATTR_GET_LATEST_MEMBER
A connection level attribute that enables CLI applications to retrieve the most recent TCP/IP address used by the client for a logical connection.

When the workload balancing (WLB) feature is enabled, the last member address can be a member address, primary group address, or alternate group address. If WLB is not enabled, the SQL_ATTR_GET_LATEST_MEMBER attribute returns the DSN information that is used to establish the logical connection. The DSN information that is returned can be a primary group address or an alternate group address. The DSN information is obtained from the local db2dsdriver.cfg file, or the node directory if the db2dsdriver.cfg file is not in use. The alternate group address is obtained from the local db2dsdriver.cfg file. The value returned is an IP address and a port, expressed as a port number or service name. The format of the returned value is: "hostname:port".

The CLI0106E error message is returned if you try to use this attribute before establishing a database connection.

SQL_ATTR_GET_LATEST_MEMBER_NAME
A connection level attribute that enables CLI applications to retrieve the most recent member name that is used by the client for a logical connection.

The SQL_ATTR_GET_LATEST_MEMBER_NAME attribute can be specified only when the client affinities feature is enabled with the db2dsdriver.cfg file.

The member name information is obtained from the <alternateserverlist> subsection of the local db2dsdriver.cfg file.

SQL_ATTR_INFO_ACCTSTR
The SQL_ATTR_INFO_ACCTSTR attribute is used to set the client accounting string that is sent to a database. The CLI driver has limit of 255 characters for the SQL_ATTR_INFO_ACCTSTR attribute.
Database servers enforce different limitation in the length of the SQL_ATTR_INFO_ACCTSTR attribute value and can truncate it. Note the following conditions:
  • Db2 for z/OS Version 11 servers in new function mode (NFM) support a length of up to 255 characters for the CURRENT CLIENT_ACCTNG special register.
  • Db2 for z/OS servers remove trailing spaces that are specified in the SQL_ATTR_INFO_ACCTSTR attribute value.
  • Db2 for z/OS Version 10 and earlier servers support a length of up to 200 characters.
  • CLI applications can set the SQL_ATTR_INFO_ACCTSTR attribute on Db2 for IBM i V6R1 and later servers. Db2 for IBM i servers support a length of up to 255 characters.
To ensure that the data is converted correctly when transmitted to Db2 for z/OS Version 9 and earlier servers, use only the characters A-Z and 0-9 and the underscore (_) or period (.).

For connection to Db2 for z/OS servers, the SQL_ATTR_INFO_ACCTSTR attribute is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

You can obtain the default value that is set by the client on the Db2 for z/OS server when the following conditions are met:
  • You have not explicitly set the client accounting registry value.
  • The enableDefaultClientInfo IBM data server driver configuration keyword is set to True.
The default value is the null string.

The SQL_ATTR_INFO_ACCTSTR attribute is an IBM defined attribute.

SQL_ATTR_INFO_APPLNAME
The SQL_ATTR_INFO_APPLNAME attribute is used to set the client application name that is sent to a database. The CLI driver has limit of 255 characters for the SQL_ATTR_INFO_APPLNAME attribute.
Database servers enforce different limitation in the length of the SQL_ATTR_INFO_APPLNAME attribute value and can truncate it. Note the following conditions:
  • Db2 for z/OS Version 11 servers in new function mode (NFM) support a length of up to 255 characters for the CURRENT CLIENT_APPLNAME special register.
  • Db2 for z/OS servers remove trailing spaces that are specified in the SQL_ATTR_INFO_APPLNAME attribute value.
  • Db2 for z/OS Version 10 and earlier servers support a length of up to 32 characters.
  • CLI applications can set the SQL_ATTR_INFO_APPLNAME attribute on Db2 for IBM i V6R1 and later servers. Db2 for IBM i servers support a length of up to 255 characters.
To ensure that the data is converted correctly when transmitted to Db2 for z/OS Version 9 and earlier servers, use only the characters A-Z and 0-9 and the underscore (_) or period (.).

For connection to Db2 for z/OS servers, the SQL_ATTR_INFO_APPLNAME attribute is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

You can obtain the default value that is set by the client on the Db2 for z/OS server when the following conditions are met:
  • You have not explicitly set the client application name registry value.
  • The enableDefaultClientInfo IBM data server driver configuration keyword is set to True.
The default value is the current application process name.

If you change the client application name and the accounting string is set by the WLM_SET_CLIENT_INFO procedure, the accounting string that is stored on the server is updated with the value of the accounting string from the client information.

The SQL_ATTR_INFO_APPLNAME attribute is an IBM defined attribute.

SQL_ATTR_INFO_CRRTKN
The SQL_ATTR_INFO_CRRTKN attribute is used to set the client correlation token that is sent to Db2 for z/OS Version 11 server in new function mode (NFM). The SQL_ATTR_INFO_CRRTKN attribute is replayed upon connection failover when the advanced client reroute (ACR) feature and the workload balance (WLB) feature are enabled.
The SQL_ATTR_INFO_CRRTKN attribute is subject to the following conditions:
  • You can specify the SQL_ATTR_INFO_CRRTKN attribute when you are connecting to Db2 for z/OS Version 11 server in new function mode (NFM).
  • Db2 for z/OS servers set the CURRENT CLIENT_CORR_TOKEN special register with the SQL_ATTR_INFO_CRRTKN attribute value.
  • Db2 for z/OS servers remove trailing spaces that are specified in the SQL_ATTR_INFO_CRRTKN attribute value.
  • There is no monitoring support for the client correlation token value in the Db2 connect gateway server.
  • The SQL_ATTR_INFO_CRRTKN attribute value is sent to the server without any client side validation.
  • The character string that is provided for the SQL_ATTR_INFO_CRRTKN attribute must be null terminated.
  • The SQL_ATTR_INFO_CRRTKN attribute has limit of 255 characters.
  • The SQL_ATTR_INFO_CRRTKN attribute is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

The default SQL_ATTR_INFO_CRRTKN attribute value is the DRDA correlation token that is generated during a connection. A database client typically generates the DRDA correlation token value. However, if the database client cannot generate the value, the database server generates the value.

You can obtain the default value that is set by the client on the Db2 for z/OS server when the following conditions are met:
  • You have not explicitly set the client correlation token registry value.
  • The enableDefaultClientInfo IBM data server driver configuration keyword is set to True.
The default value is the DRDA correlation token that is generated during a connection. A database client typically generates the DRDA correlation token value. However, if the database client cannot generate the value, the database server generates the value.

The SQL_ATTR_INFO_CRRTKN attribute is an IBM defined attribute.

SQL_ATTR_INFO_PROGRAMID
A user-defined character string, with a maximum length of 80 bytes, that associates an application with a connection. Once this attribute is set, Db2 for z/OS Version 8 and later associates this identifier with any statements inserted into the dynamic SQL statement cache.

This attribute is only supported for CLI applications accessing Db2 for z/OS Version 8 and later or Informix database server.

Note: The SQL_ATTR_INFO_PROGRAMID attribute is an IBM defined attribute.
SQL_ATTR_INFO_PROGRAMNAME
A null-terminated user-defined character string, up to 20 bytes in length, used to specify the name of the application running on the client.

When this attribute is set before the connection to the server is established, the value specified overrides the actual client application name and will be the value that is displayed in the appl_name monitor element. When connecting to a Db2 for z/OS server, the first 12 characters of this setting are used as the CORRELATION IDENTIFIER of the associated Db2 for z/OS thread.

Note: The SQL_ATTR_INFO_PROGRAMNAME attribute is an IBM defined attribute.
SQL_ATTR_INFO_USERID
The SQL_ATTR_INFO_USERID attribute is used to set the client user ID (accounting user ID) that is sent to a database. The SQL_ATTR_INFO_USERID attribute is for identification purposes only and is not used for any authentication. Do not confuse the SQL_ATTR_INFO_USERID attribute with the authentication user ID.

 The CLI driver has limit of 255 characters for the SQL_ATTR_INFO_USERID attribute.

Database servers enforce different limitation in the length of the SQL_ATTR_INFO_USERID attribute value and can truncate it. Note the following conditions:
  • Db2 for z/OS Version 11 servers in new function mode (NFM) support a length of up to 128 characters for the CURRENT CLIENT_USERID special register.
  • Db2 for z/OS servers remove trailing spaces that are specified in the SQL_ATTR_INFO_USERID attribute value.
  • Db2 for z/OS Version 10 and earlier servers support a length of up to 16 characters.
  • CLI applications can set the SQL_ATTR_INFO_USERID attribute on Db2 for IBM i V6R1 and later servers. Db2 for IBM i servers support a length of up to 255 characters.
To ensure that the data is converted correctly when transmitted to Db2 for z/OS Version 9 and earlier server, use only the characters A-Z and 0-9 and the underscore (_) or period (.).

For connection to Db2 for z/OS servers, the SQL_ATTR_INFO_USERID attribute is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

You can obtain the default value that is set by the client on the Db2 for z/OS server when the following conditions are met:
  • You have not explicitly set the client user ID (accounting user ID) registry value.
  • The enableDefaultClientInfo IBM data server driver configuration keyword is set to True.
The default value is the user ID that was specified for a connection.

If you change the client user ID and the accounting string is set by the WLM_SET_CLIENT_INFO procedure, the accounting string that is stored on the server is updated with the value of the accounting string from the client information.

The SQL_ATTR_INFO_USERID attribute is an IBM defined attribute.

SQL_ATTR_INFO_WRKSTNNAME
The SQL_ATTR_INFO_WRKSTNNAME attribute is used to set the client workstation name that is sent to a database.  The CLI driver has limit of 255 characters for the SQL_ATTR_INFO_WRKSTNNAME attribute.
Database servers enforce different limitation in the length of the SQL_ATTR_INFO_WRKSTNNAME attribute value and can truncate it. Note the following conditions:
  • Db2 for z/OS Version 11 servers in new function mode (NFM) support a length of up to 255 characters for the CURRENT CLIENT_WRKSTNNAME special register.
  • Db2 for z/OS servers remove trailing spaces that are specified in the SQL_ATTR_INFO_WRKSTNNAME attribute value.
  • Db2 for z/OS Version 10 and earlier servers support a length of up to 18 characters.
  • CLI applications can set the SQL_ATTR_INFO_WRKSTNNAME attribute on Db2 for IBM i V6R1 and later servers. Db2 for IBM i servers support a length of up to 255 characters.
To ensure that the data is converted correctly when transmitted to Db2 for z/OS Version 9 and earlier server, use only the characters A-Z and 0-9 and the underscore (_) or period (.).

If the SQL_ATTR_INFO_WRKSTNNAME attribute is not specified, a default value that consists of the host name is used. The host name is obtained by calling the gethostname() function. If the host name is not configured or an error is encountered during the gethostname() function call, no value for the SQL_ATTR_INFO_WRKSTNNAME attribute is sent to the server.

For connection to Db2 for z/OS servers, the SQL_ATTR_INFO_WRKSTNNAME attribute is replayed upon connection failover when the automatic client reroute (ACR) feature and the workload balance (WLB) feature are enabled.

You can obtain the default value that is set by the client on the Db2 for z/OS server when the following conditions are met:
  • You have not explicitly set the client workstation name registry value.
  • The enableDefaultClientInfo IBM data server driver configuration keyword is set to True.
The default value is the host name of the client.

The SQL_ATTR_INFO_WRKSTNNAME attribute is an IBM defined attribute.

SQL_ATTR_KEEP_DYNAMIC
A 32-bit unsigned integer value which specifies whether the KEEPDYNAMIC option has been enabled. If enabled, the server will keep dynamically prepared statements in a prepared state across transaction boundaries.
  • 0 - KEEPDYNAMIC functionality is not available; CLI packages were bound with the KEEPDYNAMIC NO option
  • 1 - KEEPDYNAMIC functionality is available; CLI packages were bound with the KEEPDYNAMIC YES option

It is recommended that when this attribute is set, the SQL_ATTR_CURRENT_PACKAGE_SET attribute also be set.

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_LOB_CACHE_SIZE
A 32-bit unsigned integer that specifies maximum cache size (in bytes) for LOBs. By default, LOBs are not cached.

See the LOBCacheSize CLI/ODBC configuration keyword for further usage information.

SQL_ATTR_LOB_FILE_TRESHOLD
A 32-bit integer that specifies the maximum number of bytes of LOB data buffered when SQLPutData () is used. By default, this attribute is set to 25 MB.

See the LOBFileThreshold CLI/ODBC configuration keyword for further usage information.

Attention: This feature is available in Db2 version 11.5.4 and later versions.
SQL_ATTR_LOGIN_TIMEOUT
A 32-bit integer value corresponding to the number of seconds to wait for a reply when trying to establish a connection to a server before terminating the attempt and generating a communication timeout. Specify a positive integer, up to 32 767. The default setting of 0 will allow the client to wait indefinitely.

Setting a connection timeout value can also be done using the ConnectTimeout /ODBC and IBM data server driver configuration keyword. Refer to the keyword for usage information.

SQL_ATTR_LONGDATA_COMPAT
A 32-bit integer value indicating whether the character, double byte character and binary large object data types should be reported as SQL_LONGVARCHAR, SQL_LONGVARGRAPHIC or SQL_LONGBINARY, enabling existing applications to access large object data types seamlessly. The option values are:
  • SQL_LD_COMPAT_NO (default): The large object data types are reported as IBM defined types (SQL_BLOB, SQL_CLOB, SQL_DBCLOB).
  • SQL_LD_COMPAT_YES: The IBM large object data types (SQL_BLOB, SQL_CLOB and SQL_DBCLOB) are mapped to SQL_LONGVARBINARY, SQL_LONGVARCHAR and SQL_LONGVARGRAPHIC; SQLGetTypeInfo() returns one entry each for SQL_LONGVARBINARY SQL_LONGVARCHAR, and SQL_LONGVARGRAPHIC.
Note: This is an IBM defined attribute.
SQL_ATTR_MAPCHAR
A 32-bit integer value used to specify the default SQL type associated with SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR. The option values are:
  • SQL_MAPCHAR_DEFAULT (default): return the default SQL type representation
  • SQL_MAPCHAR_WCHAR: return SQL_CHAR as SQL_WCHAR, SQL_VARCHAR as SQL_WVARCHAR, and SQL_LONGVARCHAR as SQL_WLONGVARCHAR
Only the following CLI functions are affected by setting this attribute:
  • SQLColumns()
  • SQLColAttribute()
  • SQLDescribeCol()
  • SQLDescribeParam()
  • SQLGetDescField()
  • SQLGetDescRec()
  • SQLProcedureColumns()

Setting the default SQL type associated with SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR can also be done using the MapCharToWChar CLI/ODBC and IBM data server driver configuration keyword.

Note: This is an IBM defined attribute.
SQL_ATTR_MAXBLKEXT
A 32-bit integer value that is used to set the maximum number of extra query blocks returned by a Db2 for z/OS server for a result set. SQL_ATTR_MAXBLKEXT is a connection and statement level attribute.
Possible values range from 0 to 100, with the default value being zero (0).
Restriction: The SQL_ATTR_MAXBLKEXT attribute is effective only when set for Forward Only Cursor, and when none of the following attributes and keywords are set:
  • The SQL_ATTR_MAX_ROWS attribute
  • The SQL_ATTR_OPTIMIZE_FOR_NROWS attribute
  • The SQL_ATTR_BLOCK_FOR_NROWS attribute
  • The OPTIMIZEFORNROWS keyword
  • The BlockForNRows keyword

For more usage information, see the MaxBlkExt CLI/ODBC and IBM Data Server Driver configuration keyword.

SQL_ATTR_MAXCONN
The SQL_ATTR_MAXCONN attribute is deprecated.
SQL_ATTR_MAX_LOB_BLOCK_SIZE
A 32-bit unsigned integer that indicates the maximum size of LOB or XML data block. Specify a positive integer, up to 2 147 483 647. The default setting of 0 indicates that there is no limit to the data block size for LOB or XML data.

During data retrieval, the server includes all of the information for the current row in its reply to the client even if the maximum block size is reached.

If both the MaxLOBBlockSize keyword and the db2set registry variable DB2_MAX_LOB_BLOCK_SIZE are specified, the value for the MaxLOBBlockSize keyword is used.

Setting the MaxLOBBlockSize CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying the maximum size of LOB or XML data block.

SQL_ATTR_METADATA_ID
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_NETWORK_STATISTICS
The SQL_ATTR_NETWORK_STATISTICS is a 32-bit integer connection attribute controls whether CLI collects network statistics for a connection. An application can retrieve the network statistics for a connection by calling the SQLGetDiagField() function and specifying SQL_DIAG_NETWORK_STATISTICS for the DiagIdentifier argument.
The permitted values are as follows:
SQL_NETWORK_STATISTICS_OFF (default)
Disables network statistics collection for a connection.
SQL_NETWORK_STATISTICS_ON
Enables network statistics collection for a connection.
SQL_NETWORK_STATISTICS_ON_SKIP_NOSERVER
In addition to enabling network statistics collection for a connection, network flows are omitted that are known to have no server time reported, for example explicit COMMIT and ROLLBACK statements.

Requests that have no server time reported can affect the usefulness of returned information, if calculations are made that subtract the server time from the network time. The SQL_NETWORK_STATISTICS_ON_SKIP_NOSERVER option excludes these requests from the values reported. Only explicit, unchained requests are excluded; autocommit and chained COMMIT statements are not skipped.

The CLI driver collects statistics for server time reported on COMMIT and ROLLBACK. The IBM data server must support the feature that reports server time for COMMIT and ROLLBACK.

SQL_ATTR_ODBC_CURSORS
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE
The SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE connection attribute enables CLI applications to specify the database code page. The code page does not have to be available on the database client where the application reside.

If you specify the same code page as the database code page, applications can fetch or insert data of CHARACTER data type without any code page conversions.

Setting the SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE attribute after allocating statement handles results in the CLI0126E (invalid operation) error. Setting the attribute to a value that is not supported by the database results in the CLI0210E error (inconsistent code page value error).

If you set SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE after setting SQL_ATTR_OVERRIDE_CODEPAGE to SQL_OVERRIDE_CODEPAGE_ON, the CLI driver returns the CLI0126E error message.

During a bind-out operation, ensure that the CLI applications allocate buffers large enough to hold the retrieved data during bind-out operations. If there is insufficient space, the CLI0002W error is returned.

Restriction: The SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE attribute is supported for connections to Db2 for z/OS database servers only.
SQL_ATTR_OVERRIDE_CODEPAGE
The SQL_ATTR_OVERRIDE_CODEPAGE connection attribute enables CLI applications to fetch or insert data of CHARACTER or GRAPHIC data type without code page conversions. The SQL_ATTR_OVERRIDE_CODEPAGE connection attribute can have following listed values:
  • SQL_OVERRIDE_CODEPAGE_ON: The CLI driver does not perform code page conversions for binding of character or graphic data.
  • SQL_OVERRIDE_CODEPAGE_OFF (default): The CLI driver performs code page conversions for binding of character or graphic data.

If you set the SQL_ATTR_OVERRIDE_CODEPAGE attribute to SQL_OVERRIDE_CODEPAGE_ON, you must ensure that data is in the correct code page.

If you set SQL_ATTR_OVERRIDE_CODEPAGE to SQL_OVERRIDE_CODEPAGE_ON after setting SQL_ATTR_OVERRIDE_CHARACTER_CODEPAGE, the CLI driver returns the CLI0126E error message.

Restriction: The SQL_ATTR_OVERRIDE_CODEPAGE attribute is supported for connections to Db2 for z/OS database servers only.
SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY
The SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY connection attribute enables CLI applications to specify a new temporary primary member for the client affinities feature.
The SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute can be specified under following conditions:
  • The client affinities feature must be enabled in the db2dsdriver.cfg file.
  • The new primary member that is specified with the SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute must be part of the members that are listed for the client affinities feature in the db2dsdriver.cfg file or an empty string.
  • The SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute can be specified only after the connection is established.
When the new primary member is specified with the SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute, the client affinities member list consists of sequence of member after the selected new primary member. For example, if you have three members Server1, Server2, and Server3 listed for the client affinities feature in the db2dsdriver.cfg file and you specify the Server2 as the new primary member with the SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute, the new client affinities member list consists of Server2, Server3, and Server1.

If the empty string value is specified for the SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute, the primary member is reverted to first member listed in the db2dsdriver.cfg file for the client affinities feature.

The new temporary primary member that is specified with the SQL_ATTR_OVERRIDE_PRIMARY_AFFINITY attribute is stored in memory and does not affect the order of members that are listed in the db2dsdriver.cfg file.

SQL_ATTR_PACKET_SIZE
The SQL_ATTR_PACKET_SIZE connection attribute is defined in the ODBC specification. However, the SQL_ATTR_PACKET_SIZE attribute is not supported by the CLI driver. Any attempt to set or get this attribute results in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_PARC_BATCH
For applications that use array input to achieve bulk inserts, deletes, or updates, the SQL_ATTR_PARC_BATCH attribute indicates whether the application receives the number of rows in a table that were affected by each parameter set or the cumulative number of rows that were affected for the entire parameter set. This connection attribute is available for non-atomic operations. The possible values are as follows:
  • SQL_PARC_BATCH_ENABLE: CLI returns the number of rows in a table that were affected by each parameter set.
  • SQL_PARC_BATCH_DISABLE (default): CLI returns the total number of rows that were affected for the entire parameter set.

If you set this connection attribute to SQL_PARCH_BATCH_ENABLE, you must indicate an array as the RowCountPtr parameter in the SQLRowCount () function and you must set SQL_ATTR_PARAMOPT_ATOMIC to SQL_ATOMIC_NO. If SQL_ATTR_PARAMOPT_ATOMIC is set to SQL_ATOMIC_YES, the CLI0150E error message is returned when you call the SQLExecute () function.

SQL_ATTR_PING_DB
A 32-bit integer which is used with the SQLGetConnectAttr() function to get the ping time in microseconds.

If an existing connection is dropped by the database, a value of 0 is reported. If the connection is closed by the application, then an SQLSTATE of 08003 is reported. The SQL_ATTR_PING_DB attribute can be returned by the SQLGetConnectAttr() function, but cannot be set by the SQLSetConnectAttr() function. Any attempt to set this attribute results in an SQLSTATE of 7HYC00 (Driver not capable)

Note: The SQL_ATTR_PING_DB attribute is an IBM defined attribute.
SQL_ATTR_PING_NTIMES
A 32-bit integer that sets the number of ping iterations the CLI driver issues. The time value that is associated with the ping operation is retrieved with the SQLGetConnectAttr() function with the SQL_ATTR_PING_DB attribute. If you set SQL_ATTR_PING_NTIMES to a value greater than 1, SQL_ATTR_PING_DB returns the average time that the CLI driver took to ping the database for the set of iterations.
This attribute has a valid range from 1 to 32767 (inclusive). The SQLGetConnectAttr() function checks the value and returns the appropriate error code when the value is outside this range.
When automatic client reroute is enabled and the ping operation to a member fails, the CLI driver pings SQL_ATTR_PING_NTIMES to the new member, after a seamless failover. The CLI driver pings the new member until all iterations are successful for that member. If there are no available members, the SQLGetConnectAttr() function with the SQL_ATTR_PING_DB attribute returns an error to the application. A time value of zero (0) is reported.
SQL_ATTR_PING_REQUEST_PACKET_SIZE
A 32-bit integer that is used with SQLGetConnectAttr() that sets the size of the ping packet that CLI uses when the application uses SQL_ATTR_PING_DB.
This attribute has a valid range from 1 to 32767 (inclusive).SQLGetConnectAttr() checks the value and returns the appropriate error code when the value is outside this range.
SQL_ATTR_QUERY_PREFETCH
A 32-bit integer that enables a client to send a prefetch request to the server when SQLFetch () is called. By default, this attribute is set to 0 (disabled).

See the QueryPrefetch CLI/ODBC configuration keyword for further usage information.

SQL_ATTR_QUIET_MODE
A 32-bit platform specific window handle.

If the application has never made a call to SQLSetConnectAttr() with this option, then CLI would return a null parent window handle on SQLGetConnectAttr() for this option and use a null parent window handle to display dialogue boxes. For example, if the end user has asked for (via an entry in the CLI initialization file) optimizer information to be displayed, CLI would display the dialogue box containing this information using a null window handle. (For some platforms, this means the dialogue box would be centered in the middle of the screen.)

If ValuePtr is set to null , then CLI does not display any dialogue boxes. In cases where end user asked for the optimizer estimates to be displayed, CLI would not display these estimates because the application explicitly wants to suppress all such dialogue boxes.

If ValuePtr is not null, then it should be the parent window handle of the application. CLI uses this handle to display dialogue boxes. (For some platforms, this means the dialogue box would be centered with respect to the active window of the application.)

Note: This connection option cannot be used to suppress the SQLDriverConnect() dialogue box (which can be suppressed by setting the fDriverCompletion argument to SQL_DRIVER_NOPROMPT).
SQL_ATTR_READ_ONLY_CONNECTION
The SQL_ATTR_READ_ONLY_CONNECTION attribute indicates whether subsequent connections are read-only.
  • SQL_READ_ONLY_CONNECTION_ON: Specifies that a new connection is read-only, which is created after you set the SQL_READ_ONLY_CONNECTION_ON attribute.
  • SQL_READ_ONLYCONNECTION_OFF: The default value. Specifies that a new connection is not read-only, which is created after you set the SQL_READ_ONLYCONNECTION_OFF attribute. Access to database objects are controlled by the authority that is associated with a user ID on the server.
When you query the SQL_ATTR_READ_ONLY_CONNECTION attribute with the SQLGetConnectAttr() function, the CLI driver returns the value that is stored on the client side. If a read-only connection fails over to another member or member of another group, the connection remains read-only.

The SQL_ATTR_READ_ONLY_CONNECTION attribute cannot be specified when you are connecting to Informix database servers.

If you are connecting to Db2 for IBM i servers, the following PTF must be applied on the server.
  • For Db2 for IBM i V6R1 server, PTF SI51729.
  • For Db2 for IBM i V7R1 server, PTF SI51732.
SQL_ATTR_RECEIVE_TIMEOUT

A 32-bit integer value that is the number of seconds a client waits for a reply from a server on an established connection before terminating the attempt and generating a communication timeout error. The default value of 0 indicates the client waits indefinitely for a reply. The receive timeout has no effect during connection establishment; it is only supported for TCP/IP, and is ignored for any other protocol. Supported values are integers from 0 to 32767.

Note: This is an IBM defined attribute.
SQL_ATTR_REOPT
A 32-bit integer value that enables query optimization for SQL statements that contain special registers or parameter markers. Optimization occurs by using the values available at query execution time for special registers or parameter markers, instead of the default estimates that are chosen by the compiler. The valid values of the attribute are:
  • 2 = SQL_REOPT_NONE (default): No query optimization occurs at query execution time. The default estimates chosen by the compiler are used for the special registers or parameter markers. The default NULLID package set is used to execute dynamic SQL statements.
  • 3 = SQL_REOPT_ONCE: Query optimization occurs once at query execution time, when the query is executed for the first time. The NULLIDR1 package set, which is bound with the REOPT ONCE bind option, is used.
  • 4 = SQL_REOPT_ALWAYS: Query optimization or reoptimization occurs at query execution time every time the query is executed. The NULLIDRA package set, which is bound with the REOPT ALWAYS bind option, is used.
The NULLIDR1 and NULLIDRA are reserved package set names, and when used, REOPT ONCE and REOPT ALWAYS are implied. These package sets have to be explicitly created with these commands:
db2 bind db2clipk.bnd collection NULLIDR1
db2 bind db2clipk.bnd collection NULLIDRA 
SQL_ATTR_REOPT and SQL_ATTR_CURRENT_PACKAGE_SET are mutually exclusive, therefore, if one is set, the other is not allowed.

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_REPORT_ISLONG_FOR_LONGTYPES_OLEDB
A 32-bit integer value. The OLE DB client cursor engine and the OLE DB .NET Data Provider CommandBuilder object generate UPDATE and DELETE statements based on column information provided by the IBM Db2 OLE DB Provider. If the generated statement contains a LONG type in the WHERE clause, the statement will fail because LONG types cannot be used in a search with an equality operator. The possible values are as follows:
  • 0 (default): LONG types (LONG VARCHAR, LONG VARCHAR FOR BIT DATA, LONG VARGRAPHIC and LONG VARGRAPHIC FOR BIT DATA) do not have the DBCOLUMNFLAGS_ISLONG flag set, which might cause the columns to be used in the WHERE clause.
  • 1: The IBM Db2 OLE DB Provider reports LONG types (LONG VARCHAR, LONG VARCHAR FOR BIT DATA, LONG VARGRAPHIC and LONG VARGRAPHIC FOR BIT DATA) with the DBCOLUMNFLAGS_ISLONG flag set. This will prevent the long columns from being used in the WHERE clause.
This attribute is supported by the following database servers:
  • Db2 for z/OS
    • Version 8 with PTF UQ93890
    • Versions later than Version 8, PTFs are not required
  • Db2

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_REPORT_SEAMLESSFAILOVER_WARNING
A 32-bit unsigned integer value that specifies whether to return a warning message on a connect or an execute request if a seamless failover occurred during the request. The SQL_ATTR_REPORT_SEAMLESSFAILOVER_WARNING attribute has following possible values:
  • SQL_REPORT_SEAMLESSFAILOVER_WARNING_YES: If a seamless failover occurred during a connect or an execute request, a warning message is returned.
  • SQL_REPORT_SEAMLESSFAILOVER_WARNING_NO (default): If a seamless failover occurred during a connect or an execute request, a warning message is not returned.
SQL_ATTR_REPORT_TIMESTAMP_TRUNC_AS_WARN
A 32-bit unsigned integer value that specifies whether a datetime overflow results in an error (SQLSTATE 22008) or warning (SQLSTATE 01S07). The possible values are as follows:
  • 0 (default): Datetime overflow results in an error (SQLSTATE 22008).
  • 1: Datetime overflow results in a warning (SQLSTATE 01S07).
SQL_ATTR_RETRY_ON_MERGE
An integer value that specifies the number of retry attempts that can be made for a MERGE statement with the array input chaining feature enabled. The array input chaining feature can be enabled for a connection to Db2, Db2 for IBM i, or Db2 for z/OS servers. The ColumnwiseMRI keyword or the SQL_ATTR_COLUMNWISE_MRI attribute can be used to enable the array input chaining feature when you are connecting to Db2 for z/OS servers.

The ArrayInputChain keyword with the SQL_ATTR_CHAINING_BEGIN and SQL_ATTR_CHAINING_END statement attributes are used to enable the array input chaining feature when you are connecting to Db2 or Db2 for IBM i servers. For connection to Db2 for IBM i server, the SQL_ATTR_RETRY_ON_MERGE parameter is supported on Db2 for IBM i V7R1 and later releases.

The CLI driver allocates an array buffer that consists of 100 elements for each parameter that you provide by using the SQLBindParameter() or SQLExtendedBind() function. When an error is encountered due to a resource contention issue on the server, the CLI driver constructs an array of failed rows and reruns the statement again for the number of iterations set with the SQL_ATTR_RETRY_ON_MERGE attribute.

  • 0 (default): The default value. No retry attempt is made.
  • 1-6: The number of retry attempts that can be made. The maximum number of retry attempts is six.
The SQL_ATTR_RETRY_ON_MERGE attribute setting has no effect under the following conditions:
  • If any of the following data types are bound as a parameter in a MERGE operation:
    • SQL_CLOB
    • SQL_BLOB
    • SQL_LONGVARBINARY
    • SQL_LONGVARGRAPHIC
    • SQL_DBCLOB
    • SQL_XML
  • If a parameter is bound with the SQL_DATA_AT_EXEC argument in a MERGE operation, which requires calls to the SQLPutData() and SQLParamData() functions.
  • If any of the following statement attributes are specified in a MERGE operation:
    • SQL_ATTR_INTERLEAVED_PUTDATA
    • SQL_ATTR_INTERLEAVED_STREAM_PUTDATA
    • SQL_ATTR_USE_LOAD_API
  • If array parameters are specified for a MERGE operation.
  • If the SQL_ATTR_INSERT_BUFFERING statement attribute is enabled in a connection to a Db2 server.
  • If the CLI driver is unable to allocate required internal buffers to store application data.
SQL_ATTR_RETRYONERROR
CLI attempts recover from non-fatal errors, such as incorrect binding of application parameters, by retrieving additional information about the failing SQL statement and then executing the statement again. The additional information retrieved includes input parameter information from the database catalog tables. If CLI is able to recover successfully from the error, by default, it does not report the error to the application. The CLI/ODBC configuration keyword ReportRetryErrorsAsWarnings allows you to set whether error recovery warnings are returned to the application or not.
Note: Once CLI has successfully completed the error recovery, the application may behave differently, because CLI uses the catalog information gathered during the recovery for subsequent executions of that particular SQL statement, rather than the information provided in the original SQLBindParameter() function calls. If you do not want this behavior, set RetryOnError to 0, forcing CLI not to attempt recovery. You should, however, modify the application to correctly bind statement parameters..
SQL_ATTR_SERVER_MSGTXT_MASK
A 32-bit integer value used to indicate when CLI should request the error message from the server. This attribute is used in conjunction with the SQL_ATTR_SERVER_MSGTXT_SP attribute. The attribute can be set to:
  • SQL_ATTR_SERVER_MSGTXT_MASK_LOCAL_FIRST (default): CLI will check the local message files first to see if the message can be retrieved. If no matching SQLCODE is found, then CLI will request the information from the server.
  • SQL_ATTR_SERVER_MSGTXT_MASK_WARNINGS: CLI always requests the message information from the server for warnings but error messages are retrieved from the local message files.
  • SQL_ATTR_SERVER_MSGTXT_MASK_ERRORS: CLI always requests the message information from the server for errors but warning messages are retrieved from the local message files.
  • SQL_ATTR_SERVER_MSGTXT_MASK_ALL: CLI always requests the message information from the server for both error and warning messages.

Setting the ServerMsgMask CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying this behavior.

Note: This is an IBM defined attribute.
SQL_ATTR_SERVER_MSGTXT_SP
A pointer to a character string used to identify a stored procedure that is used for generating an error message based on an SQLCA. This can be useful when retrieving error information from a server such as Db2 for z/OS. The attribute can be set to:
  • SYSIBM.SQLCAMESSAGE: The default procedure called to retrieve the message text from Db2 for z/OS servers. If you do not set this attribute, this procedure is called.
  • DSNACCMG: The default procedure called to retrieve the message text from Db2 for z/OS Version 7 servers. The SYSIBM.SQLCAMESSAGE procedure is called to retrieve the message text from Db2 for z/OS Version 8 or later. DSNACCMG has been deprecated in Db2 for z/OS Version 9 and might be removed in a future release.
  • Any user-created stored procedure.

Applications using this attribute can also set the SQL_ATTR_SERVER_MSGTXT_MASK attribute to indicate when CLI should call this procedure to retrieve the message information from the server. If the SQL_ATTR_SERVER_MSGTXT_MASK is not set, then the default is to check the local message files first (see SQL_ATTR_SERVER_MSGTXT_MASK_LOCAL_FIRST in SQL_ATTR_SERVER_MSGTXT_MASK).

Setting the UseServerMsgSP CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying this behavior.

Note: This is an IBM defined attribute.
SQL_ATTR_SESSION_GLOBAL_VAR
Sets global variables. Can set multiple global variables separated by semicolons. Supports values that are any null-terminated character strings of up to 255 characters. No default value.

If you reference a global variable which has not been created in the server, the data server will throw an error.

SQL_ATTR_SESSION_TIME_ZONE
A null-terminated character string in the format ±hh:mm, containing the server session time zone information. This is a set-only attribute. The supported time zone values range from -12:59 through +14:00.
SQL_ATTR_SPECIAL_REGISTER
All the special registers will be piggybacked and will be flown to the server on the next SQL statement execution. Supports values that are any null-terminated character string of up to 255 characters.
SQL_ATTR_SQLCOLUMNS_SORT_BY_ORDINAL_OLEDB
A 32-bit integer value. The Microsoft OLE DB specification requires that IDBSchemaRowset::GetRowset(DBSCHEMA_COLUMNS) returns the row set sorted by the columns TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME. The IBM Db2 OLE DB Provider conforms to the specification, however, applications that use the Microsoft ODBC Bridge provider (MSDASQL) have been typically coded to get the row set sorted by ORDINAL_POSITION. The possible values are as follows:
  • 0 (default): The IBM Db2 OLE DB Provider returns a row set sorted by the columns TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME.
  • 1: The IBM Db2 OLE DB Provider returns a row set sorted by ORDINAL_POSITION.
This attribute is supported by the following database servers:
  • Db2 for z/OS
    • Version 8 with PTF UQ93890
    • Versions later than version 8, PTFs are not required
  • Db2

This attribute is not supported when accessing Informix database servers.

Note: This is an IBM defined attribute.
SQL_ATTR_STMT_CONCENTRATOR
Specifies whether dynamic statements that contain literal values use the statement cache.
  • SQL_STMT_CONCENTRATOR_OFF - The statement concentrator behavior is disabled.
  • SQL_STMT_CONCENTRATOR_WITH_LITERALS - The statement concentrator with literal behavior is enabled for situations that are supported by the server. For example, the statement concentrator is not enabled if the statement has parameter markers, named parameter markers, or a mix of literals, parameter markers, and named parameter markers.

Setting the StmtConcentrator CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying this behavior.

SQL_ATTR_STREAM_GETDATA
A 32-bit unsigned integer that indicates if the data output stream for the SQLGetData() function will be optimized. The values are:
  • 0 (default): CLI buffers all the data on the client.
  • 1: For applications that do not need to buffer data and are querying data on a server that supports Dynamic Data Format, also known as progressive streaming, specify 1 to indicate that data buffering is not required. The CLI client will optimize the data output stream.

This keyword is ignored if Dynamic Data Format is not supported by the server.

If StreamGetData is set to 1 and CLI cannot determine the number of bytes still available to return in the output buffer, SQLGetData() returns SQL_NO_TOTAL (-4) as the length when truncation occurs. Otherwise, SQLGetData() returns the number of bytes still available.

Setting the StreamGetData CLI/ODBC and IBM data server driver configuration keyword is an alternative method of specifying this behavior.

SQL_ATTR_STREAM_OUTPUTLOB_ON_CALL
The SQL_ATTR_STREAM_OUTPUTLOB_ON_CALL attribute specifies streaming of OUT parameters of stored procedures that are LOB or XML data type. You can also specify the SQL_ATTR_STREAM_OUTPUTLOB_ON_CALL attribute to obtain the data length information for OUT parameters that are LOB and XML data type. The SQL_ATTR_STREAM_OUTPUTLOB_ON_CALL attribute can have one of the following values:
  • SQL_STREAM_OUTPUTLOB_ON_CALL_FALSE (default): Disables the streaming of OUT parameter data that are LOB or XML data type for CALL statements.
  • SQL_STREAM_OUTPUTLOB_ON_CALL_TRUE: Enables the streaming of OUT parameter data that are LOB or XML data type for CALL statements.
You must ensure that the following conditions are satisfied to get the actual data length information and stream the OUT parameter data that are LOB or XML data type:
  • Specify NULL value for the rgbValue argument of the SQLBindParameters() function for OUT parameters that are LOB and XML data type.
  • If application requires the data length information for OUT parameters that are LOB and XML data type, you must pass the valid memory address to an SQLINTEGER variable for the pcbValue argument of the SQLBindParameter() function. Successful CALL statement through use of the SQLExecute() function returns the length information in the SQLINTEGER variable.
  • All OUT parameter data from the stored procedure call are retrieved with the SQLGetData() function before you retrieve any result sets with the SQLFetch() function. Calling the SQLFetch() function causes the CLI driver to delete all the data buffers.
  • The LOB locators are not used.
  • The OUT parameters of stored procedures are not ARRAY form of LOB or XML data type.
SQL_ATTR_SYNC_POINT
The SQL_ATTR_SYNC_POINT attribute has been deprecated.
SQL_ATTR_TIME_FMT
The SQL_ATTR_TIME_FMT attribute specifies the time format. The SQL_ATTR_TIME_FMT attribute can be set to one of the following values:
  • SQL_IBMi_FMT_ISO: Specifies the International Standards Organization (ISO) time format of hh.mm.ss.
  • SQL_IBMi_FMT_USA: Specifies the United States time format of hh:mm xx, where xx is AM or PM.
  • SQL_IBMi_FMT_EUR: Specifies the European time format of hh.mm.ss.
  • SQL_IBMi_FMT_JIS: Specifies the Japanese Industrial Standard time format of hh:mm:ss.
  • SQL_IBMi_FMT_HMS: Specifies the time format of hh:mm:ss.

The default value for the SQL_ATTR_TIME_FMT attribute is determined by the DATETIME bind option that is specified for packages. If the default DATETIME bind option is specified for the CLI packages, SQL_IBMi_FMT_JIS is the default value for the SQL_ATTR_TIME_FMT attribute.

The SQL_ATTR_TIME_FMT attribute is only valid for use with the Db2 for IBM i server.
Note: The SQL_ATTR_TIME_FMT attribute is an IBM defined attribute.
SQL_ATTR_TIME_SEP
The SQL_ATTR_TIME_SEP attribute specifies the time separator. The SQL_ATTR_TIME_SEP attribute can be set to one of the following values:
  • SQL_SEP_COLON: Specifies a colon( : ) for the time separator.
  • SQL_SEP_PERIOD: Specifies a period ( . ) for the time separator.
  • SQL_SEP_COMMA: Specifies a comma ( , ) for the time separator.
  • SQL_SEP_BLANK: Specifies a blank for the time separator.
  • SQL_SEP_JOB: Specifies the job default for the time separator.

The default value for the SQL_ATTR_TIME_SEP attribute is determined by the DATETIME bind option that is specified for packages. If the default DATETIME bind option is specified for the CLI packages, SQL_SEP_COLON is the default value for the SQL_ATTR_TIME_SEP attribute.

The SQL_ATTR_TIME_SEP attribute is only valid for use with Db2 for IBM i servers after you set the SQL_ATTR_TIME_FMT attribute to SQL_IBMi_FMT_HMS.
Note: The SQL_ATTR_TIME_SEP attribute is an IBM defined attribute.
SQL_ATTR_TRACE
This connection attribute can be set by an application for the ODBC Driver Manager. Any attempt to set this connection attribute for the CLI Driver will result in an SQLSTATE of HYC00 (Driver not capable).

Instead of using this connection attribute, the CLI trace facility can be set using the Trace CLI/ODBC configuration keyword. Alternatively, the environment attribute SQL_ATTR_TRACE can be used to configure tracing features. Note that the environment attribute does not use the same syntax as the ODBC Driver Manager's connection attribute.

SQL_ATTR_TRACEFILE
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute will result in an SQLSTATE of HYC00 (Driver not capable).

Instead of using this attribute, the CLI trace file name is set using the TraceFileName CLI/ODBC configuration keyword.

SQL_ATTR_TRANSLATE_LIB
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute on other platforms will result in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_TRANSLATE_OPTION
This connection attribute is defined by ODBC, but is not supported by CLI. Any attempt to set or get this attribute on other platforms will result in an SQLSTATE of HYC00 (Driver not capable).
SQL_ATTR_TRUSTED_CONTEXT_PASSWORD
A user defined string containing a password. Use this attribute if the database server requires a password when switching users on a trusted connection. Set this attribute after setting the attribute SQL_ATTR_TRUSTED_CONTEXT_USERID and before executing any SQL statements that access the database server. If SQL_ATTR_TRUSTED_CONTEXT_USERID is not set before setting this attribute, an error (CLI0198E) is returned.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_TRUSTED_CONTEXT_ACCESSTOKEN
Note: This feature is available starting from Db2 version 11.5.4.
A user defined string containing an access token. The type of token must the same as the access token type used to establish the original connection. Use this attribute if the database server requires a credential when switching users on a trusted connection. Do not use it when creating a trusted connection.

After setting this attribute, the user switch will occur the next time that you execute an SQL statement that accesses the database server. (SQLSetConnectAttr does not access the database server.) If the user switch is successful, the user defined within the token in this attribute becomes the new user of the connection. If the user switch fails, the call that initiated the switch will return an error indicating the reason for the failure.

If you set this attribute while the connection handle is not yet connected to a database or if the connection is not a trusted connection then an error (CLI0197E) is returned.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_TRUSTED_CONTEXT_USERID

A user defined string containing a user ID. Use this on existing trusted connections to switch users. Do not use it when creating a trusted connection.

After setting this attribute the user switch will occur the next time that you execute an SQL statement that accesses the database server. (SQLSetConnectAttr does not access the database server.) If the user switch is successful the user ID in this attribute becomes the new user of the connection. If the user switch fails the call that initiated the switch will return an error indicating the reason for the failure.

The user ID must be a valid authorization ID on the database server unless you are using an identity server, in which case you can use any user name recognized by the identity server. (If you are using an identity server see also SQL_ATTR_USER_REGISTRY_NAME.)

If you set this attribute while the connection handle is not yet connected to a database or if the connection is not a trusted connection then an error (CLI0197E) is returned.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_TXN_ISOLATION
A 32-bit bitmask that sets the transaction isolation level for the current connection referenced by ConnectionHandle. The valid values for ValuePtr can be determined at runtime by calling SQLGetInfo() with fInfoType set to SQL_TXN_ISOLATION_OPTIONS. The following values are accepted by CLI, but each server might only support a subset of these isolation levels:
  • SQL_TXN_READ_UNCOMMITTED - Dirty reads, non-repeatable reads, and phantom reads are possible.
  • SQL_TXN_READ_COMMITTED (default) - Dirty reads are not possible. Non-repeatable reads and phantom reads are possible.
  • SQL_TXN_REPEATABLE_READ - Dirty reads and reads that cannot be repeated are not possible. Phantoms are possible.
  • SQL_TXN_SERIALIZABLE - Transactions can be serialized. Dirty reads, non-repeatable reads, and phantoms are not possible.
  • SQL_TXN_NOCOMMIT - Any changes are effectively committed at the end of a successful operation; no explicit commit or rollback is allowed. This is analogous to autocommit. This is not an SQL92 isolation level, but an IBM defined attribute, supported only by the Db2 for IBM i server.
In IBM terminology,
  • SQL_TXN_READ_UNCOMMITTED is Uncommitted Read;
  • SQL_TXN_READ_COMMITTED is Cursor Stability;
  • SQL_TXN_REPEATABLE_READ is Read Stability;
  • SQL_TXN_SERIALIZABLE is Repeatable Read.

This option cannot be specified while there is an open cursor on any statement handle, or an outstanding transaction for this connection; otherwise, SQL_ERROR is returned on the function call (SQLSTATE S1011).

This attribute (or corresponding keyword) is only applicable if the default isolation level is used. If the application has specifically set the isolation level then this attribute will have no effect.

Note: There is an IBM attribute that permits the setting of transaction isolation levels on a per statement handle basis. See the SQL_ATTR_STMTTXN_ISOLATION statement attribute.
SQL_ATTR_USE_TRUSTED_CONTEXT
When connecting to a Db2 database server that supports trusted contexts, set this attribute if you want the connection you are creating to be a trusted connection. If this attribute is set to SQL_TRUE and the database server determines that the connection can be trusted then the connection is a trusted connection. If this attribute is not set, if it is set to SQL_FALSE, if the database server does not support trusted contexts, or if the database server determines that the connection cannot be trusted then a regular connection is created instead and a warning (SQLSTATE 01679) is returned. This value can only be specified before the connection is established either for the first time or following a call to the SQLDisconnect() function.
SQL_ATTR_USER_REGISTRY_NAME

This attribute is only used when authenticating a user on a server that is using an identity mapping service. It is set to a user defined string that names an identity mapping registry. The format of the registry name varies depending on the identity mapping service used. By providing this attribute you tell the server that the user name provided can be found in this registry.

After setting this attribute the value will be used on subsequent attempts to establish a normal connection, establish a trusted connection, or switch the user id on a trusted connection.

On z/OS servers, you can also set the SQL_ATTR_USER_REGISTRY_NAME attribute after connection and after statement allocation. This allows you to specify the registry name and User ID to switch to a different user while in trusted connection.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_WCHARTYPE
A 32-bit integer that specifies, in a double-byte environment, which wchar_t (SQLDBCHAR) character format you want to use in your application. This option provides you the flexibility to choose between having your wchar_t data in multi-byte format or in wide-character format. There two possible values for this option:
  • SQL_WCHARTYPE_CONVERT: character codes are converted between the graphic SQL data in the database and the application variable. This allows your application to fully exploit the ANSI C mechanisms for dealing with wide character strings (for example, L-literals, 'wc' string functions) without having to explicitly convert the data to multi-byte format before communicating with the database. The disadvantage is that the implicit conversions might have an impact on the runtime performance of your application, and might increase memory requirements. If you want WCHARTYPE CONVERT behavior then define the C preprocessor macro SQL_WCHART_CONVERT at compile time. This ensures that certain definitions in the Db2 header files use the data type wchar_t instead of sqldbchar.
  • SQL_WCHARTYPE_NOCONVERT (default): no implicit character code conversion occurs between the application and the database. Data in the application variable is sent to and received from the database as unaltered DBCS characters. This allows the application to have improved performance, but the disadvantage is that the application must either refrain from using wide-character data in wchar_t (SQLDBCHAR) application variables, or it must explicitly call the wcstombs() and mbstowcs() ANSI C functions to convert the data to and from multi-byte format when exchanging data with the database.
Note: This is an IBM-defined attribute.
SQL_ATTR_XML_DECLARATION
A 32-bit unsigned integer that specifies which elements of an XML declaration are added to XML data when it is implicitly serialized. This attribute does not affect the result of the XMLSERIALIZE function. Set this attribute to the sum of each component required:
  • 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 or UTF-32. (Although a UTF-8 BOM exists, Db2 does not generate it, even if the target encoding is UTF-8.)
  • 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.
Attempts to set any other value using SQLSetConnectAttr() or SQLSetConnectOption() will result in a CLI0191E (SQLSTATE HY024) error, and the value will remain unchanged.

The default setting is 7, which indicates that a BOM and an XML declaration containing the XML version and encoding attribute are generated during implicit serialization.

This setting affects any statement handles allocated after the value is changed. Existing statement handles retain their original values.

This attribute is not supported when accessing Informix database servers.

SQL_ATTR_IGNORE_SERVER_LIST

This attribute is used to ignore the rerouting behavior due to ACR. Setting it to true disables the automatic client reroute feature, and hence even the client affinity feature will be ignored. By default, the attribute is not set. When it is set, connection will be made to the server as specified by the database, host name, and port information in the connection string.

This attribute will be supported for both Db2 for z/OS and Db2.