The Teradata embedded SQL preprocessor, which runs on a client system, needs to make a connection to Teradata Database. Connections are required both during precompilation and at runtime.
There is no relationship between the preprocessor connection to Teradata Database 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 Teradata Database:
IF you specify the SQLCHECK or -sc option as… | THEN the preprocessor… |
---|---|
NOSYNTAX | does not require connection to Teradata Database. |
|
requires connection to Teradata Database. |
You can establish a preprocessor connection to Teradata Database 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.
SPP9980 Fatal Error: Unexpected CLI return 280 on DBCHINI call
Runtime Execution Connection
Runtime connection to Teradata Database 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
- SQLCODE = 0
- SQLSTATE = ‘00000’
- SQLCA fields SQLWARN0 and SQLWARN2 = W (Teradata mode only)
Explicit Connections
An application can specify its connection to Teradata Database 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 to Teradata Database | 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:
|
- 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 to Teradata Database, 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 Topics
- 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.