17.20 - SQLGetInfo - Get User Name - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2022-06-21
dita:mapPath
uqj1639470627591.ditamap
dita:ditavalPath
nkw1500504256726.ditaval

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 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 database system username, but with the LDAP authentication mechanism it is possible to map the mechanism username to a different database username.