SQLGetInfo - Get User Name - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

Product
ODBC Driver for Teradata
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-07-11
dita:mapPath
smj1488824663219.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 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 
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.