16.20 - Connection Attributes - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

ODBC Driver for Teradata
August 2020
User Guide

The following table lists the connection attributes and their associated values.

Connection Attributes ValuePtr Contents
SQL_ATTR_TDATA_HOST_ID An SQLUINTEGER value in which the logical host ID for the session is returned.
SQL_ATTR_TDATA_SESSION_NUMBER An SQLUINTEGER value in which the logical session number is returned.
SQL_ATTR_TDATA_SESSION_CHARSET A null-terminated character string containing the name of the session character set is returned.
SQL_ATTR_AGKR An SQLUINTEGER value that determines the result from requests that insert into identity columns (INSERT, INSERT ... SELECT, UPSERT, MERGE-INTO). These requests can optionally return a result set containing identity column values (also known as auto-generated keys) for the inserted rows.
Values supported are as follows:

The acronym AGKR is defined as Auto-Generated Key Retrieval.

This attribute can be set to SQL_AGKR_NO(0), SQL_AGKR_IDENTITY_COLUMN(1), or SQL_AGKR_WHOLE_ROW(2), meaning respectively that no keys are retrieved, only the identity column is retrieved, or the whole row is retrieved by ODBC Driver for Teradata after an insertion into a table containing an identity column.

An error is returned if the application tries to enable the auto-generated key retrieval and the database does not support the feature. The error returned is SQL_ERROR with SQLSTATE HY024 and the message is: Invalid attribute value.