SQLGetInfo - Get User Name - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
16.20
Published
August 2020
Language
English (United States)
Last Update
2020-08-25
dita:mapPath
fxv1527114222338.ditamap
dita:ditavalPath
Audience_PDF_product_legacy_odbc_include.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities

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 topic of the ODBC API Reference section 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.