15.10 - SQLDriverConnect - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

ODBC Driver for Teradata
User Guide

SQLDriverConnect allows the ODBC driver to define an arbitrary amount of connection information in the form of keyword-value pairs in the connection string. For example, a custom program that always uses the XYZ Corp data source might prompt the user for names and passwords and build the following set of keyword-value pairs, or connection string, to pass to SQLDriverConnect:

 DSN=XYZ Corp;UID=Gomez;PWD=Sesame; 

The SQLDriverConnect function is allowed to prompt the user for required logon information unless called with the SQL_DRIVER_NOPROMPT option.

Sometimes it might be necessary to supply additional information such as Profile=MyProfile to log on to the database. In this case, the additional information is contained in the Parameter field. The Parameter value was specified when the DSN was created. Like a password, the value will be masked.

To change the value of an existing parameter or to enter a new value, the user clicks on the Change button, which is located on the Teradata Database Connect dialog box next to the Parameter field. A new Parameter dialog box displays, allowing the user to specify a new Parameter value. If a value already exists, it will be displayed in clear text and the user can edit or replace it. When changes are made, click the OK button.


 SQLRETURN SQLDriverConnect(
   SQLHDBC 	ConnectionHandle,
   SQLHWND 	WindowHandle,
   SQLCHAR * 	InConnectionString,
   SQLSMALLINT 	StringLength1,
   SQLCHAR *	OutConnectionString,
   SQLSMALLINT 	BufferLength,
   SQLSMALLINT * 	StringLength2Ptr,
   SQLUSMALLINT 	DriverCompletion);

SQLDriverConnect supports data sources that require more connection information than the three arguments in SQLConnect, dialog boxes to prompt the user for all connection information, and data sources that are not defined in the system information.

After a connection is established, SQLDriverConnect returns the completed connection string. The application can use this string for subsequent connection requests.

SQLDriverConnect returns SQL_ERROR and an error message if no authentication mechanism can be selected.

Simplified Logon Without a Connection Dialog Box

The preceding dialog boxes might not be displayed if the ODBC Driver has sufficient information to attempt logging on to the database. The behavior is controlled by arguments supplied to SQLDriverConnect.

Configuring a DSN

The DSN Setup dialog box is similar to the Teradata Database Connect dialog box, and works in a similar fashion.

Simplified Logons with the Default Mechanism

Simplified logons will not work when the default mechanism is anything other than TD2 and the Mechanism text box is blank.