Build a Teradata PT Database Connection Object - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

Product
Parallel Transporter
Release Number
17.10
Published
June 2021
Language
English (United States)
Last Update
2021-07-01
dita:mapPath
ang1608578408836.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2516
lifecycle
previous
Product Category
Teradata Tools and Utilities

In order to establish a connection with the database, users must create an object that will manage all of that connection’s important attributes. In Teradata PT, this object is called a Connection object.

There are two steps involved in building a Connection object:

  1. Create a Connection Object

    The Connection object is defined as a C++ class. A Connection object can be created by calling the Connection class constructor.

    using namespace teradata::client::API;
    Connection* conn = new Connection();
  2. Add Parameters
    The Connection object is used to house parameters for a database connection. There are three types of parameters:
    • attributes
    • schemas
    • DML Groups

Attributes

There are various types of options that can be set using attributes. Each driver has a set of required attributes and optional attributes. Depending on the attribute, there can be multiple values for that attribute. These are called array attributes. The following is an example of adding attributes and array attributes:

conn->AddAttribute(TD_MAX_SESSIONS,4);
conn->AddArrayAttribute(TD_WORK_TABLE, 2,"testa_wt","testb_wt", NULL);

Set the values for an attribute in a single call to either the AddAttribute function or the AddArrayAttribute function. Once an attribute has been set, the values of the attribute cannot be changed and additional values cannot be added to it.

Set all attributes prior to calling the Initiate function. After a Connection object has been initiated, no additional attributes may be set.