Connecting a Client Application | Teradata Vantage - Connecting a Client Application to Vantage - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
Product Category
Teradata Vantage™

The Teradata-embedded SQL preprocessor, which runs on a client system, needs to make a connection to Vantage. Connections are required both during precompilation and at runtime.

There is no relationship between the preprocessor connection to Vantage made at precompile time and the connection made by an application at runtime. They are separate events.

LOGON and CONNECT statements embedded within the SQL of a host application program have no effect on the preprocessor connection.

Preprocessor Connection

You can run the preprocessor against an application without connecting to Vantage:

IF you specify the SQLCHECK or -sc option as… THEN the preprocessor…
NOSYNTAX does not require connection.
  • FULL (or use FULL as the default)
  • SQLFLAGGER(ENTRY)
requires connection.

You can establish a preprocessor connection by using the tdpid or -t and userid or -u preprocessor options.

If you do not provide a user ID and the preprocessor is operating in the IBM mainframe environment, then an implicit connection is attempted.

For the mainframe version only, Preprocessor2 will not operate without at least one started TDP on the mainframe, even if no data access is required (that is, NOSYNTAX). If a precompile step is done on the mainframe with no started TDP, Preprocessor2 will output the message:
SPP9980 Fatal Error:
        Unexpected CLI return 280 on DBCHINI call

Runtime Execution Connection

Runtime connection to Vantage is made either explicitly or implicitly.

The TRANSACT or -tr preprocessor transaction mode setting for a session is established when the connection (either explicit or implicit) is made.

The transaction mode is based on the TRANSACT or -tr preprocessor option setting for the application that established the session.

Completion Conditions

A successful runtime connection returns the following completion codes:
  • SQLCODE = 0
  • SQLSTATE = ‘00000’
  • SQLCA fields SQLWARN0 and SQLWARN2 = W (Teradata mode only)

Explicit Connections

An application can specify its connection explicitly via the CONNECT or the LOGON statement.

Explicit connection permits precise control over which TDP and user ID to connect with, while implicit connection uses system defaults for the TDP and user ID. For this reason, any time you need to connect to a non-default TDP or user ID, you must make an explicit connection.

Explicit connections are preferable because they provide precise control, even when default TDPs and user IDs are sufficient to make a connection.

IF an explicit connection request is made and… THEN…
the application is already connected the previous connection is dropped before the new connection is attempted.
a transaction is active the connection request is rejected with an SQLCODE of -752.
the application must terminate the current transaction explicitly using one of the following before attempting to issue a new explicit connection request:
  • COMMIT
  • ROLLBACK (or ABORT)
  • LOGOFF
Any explicit connection to Vantage requires the following:
  • TDP ID
  • User ID
  • Password

TDP ID and user ID preprocessor options do not affect the application logon at execution time.

Default TDP ID

If you do not specify a tdpid, then the connection is made using the system default tdpid.

IF your application runs on this platform … THEN the default TDP is …
IBM mainframe obtained from the HSHSPB data area module
workstation-attached system the mtdpid, obtained from the user-defined clispb.dat file or the CLI2SPB data area.

Implicit Connection

If an embedded SQL application running in an IBM mainframe environment submits an SQL request without specifying an explicit connection, an implicit connection is attempted based on the job or session under which the application is running.

LAN-attached platforms do not permit implicit connections.

Related Information

  • Preprocessor invocation options, see Teradata® Preprocessor2 for Embedded SQL Programmer Guide, B035-2446.
  • User ID security, TDP IDs, and user IDs, see Teradata® Director Program Reference, B035-2416.
  • Default TDP ID obtained from the HSHSPB data area module, see Teradata® Call-Level Interface Version 2 Reference for Mainframe-Attached Systems, B035-2417.
  • Implicit connection mechanism, see Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems, B035-2418.