17.20 - SQLConnect - 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

SQLConnect assumes that a data source name, username, and password are sufficient to connect to a data source and that all other connection information can be stored on the system. This information is stored in the DSN Settings section in the registry on Windows, or in the user's odbc.ini file on Unix-based platforms.

Syntax:

SQLRETURN SQLConnect(
   SQLHDBC ConnectionHandle,
   SQLCHAR * ServerName,
   SQLSMALLINT NameLength1,
   SQLCHAR * UserName,
   SQLSMALLINT NameLength2,
   SQLCHAR * Authentication,
   SQLSMALLINT NameLength3);

SQLConnect establishes a connection to a driver and a data source. The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information.

SQLConnect is the simplest connection function. It requires a ServerName (data source name) and accepts an optional UserName and Authentication (typically a password). The UserName and Authentication parameters are passed unmodified to the driver. SQLConnect works well for applications that hard-code a data source name and do not require a UserName or Authentication.

It also works well for applications that want to control their own look and feel or that have no user interface. Such applications can build a list of data sources using SQLDataSources, prompt the user for data source, UserName, and Authentication, and then call SQLConnect.

SQLConnect establishes an authenticated connection using the authentication mechanism selected. SQLConnect returns SQL_ERROR and a new error message if no authentication mechanism can be selected.

If TeraSSO allows fully qualified usernames then the username might contain a domain or realm, for example: george@linedata.