17.00 - Build a Teradata PT Database Connection Object - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

prodname
Parallel Transporter
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-2516-220K

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.