SQLGetInfo - Get User Name

ODBC Driver for Teradata® User Guide

brand
Teradata Tools and Utilities
prodname
ODBC Driver for Teradata
vrm_release
16.20
category
User Guide
featnum
B035-2526-108K

Syntax

SQLRETURN SQLGetInfo(
  SQLHDBC 	ConnectionHandle,
  SQLUSMALLINT 	InfoType,
  SQLPOINTER 	InfoValuePtr,
  SQLSMALLINT 	BufferLength,
  SQLSMALLINT * 	StringLengthPtr);

SQLGetInfo returns general information about the driver and data source associated with a connection. The information types are described in the SQLGetInfo section of the ODBC API Reference chapter in the ODBC Programmer's Reference.

There is an InfoType, which returns the username of the current database user:

SQLGetInfo Info Type Value Returned
SQL_USER_NAME A character string with the name used in a particular database, which can be different from the login name.

Previously, the username provided to ODBC (either explicitly or implicitly through SSO) was identical to the Teradata Database username, but with the LDAP authentication mechanism it is possible to map the mechanism username to a different Teradata Database username.