15.10 - Linux - Parallel Transporter

Teradata Parallel Transporter Application Programming Interface

Parallel Transporter
Programming Reference


The following are the steps for accessing Linux code samples:

1 After you install Teradata PT, you should see the following directory structure:

\lib 					(contains 32‑bit .so files)
\lib64 				(contains 64‑bit .so files)
		\inc (contain .h files)
			\blockloading				(Shows how to load rows in buffer mode with the load driver)
			\checkpoint				(Shows how checkpoint/restart works with the stream driver)
			\common				(Contains shared files used by all samples)
			\generic				(Shows how each driver works)
			\getbuffer				(Shows how to export the driver’s GetBuffer feature)
			\inc				(Contains shared .h files used by all samples)
			\multiple				(Shows how to use multiple drivers in the same application)
			\multi_node				(Shows how to use the multi-node protocol)
			\threads				(Shows how to write multi-threaded applications)
			\xsp				(Shows how to use Teradata PT in an XSP)
		\runsamp  				(Contains precompiled TPTAPI applications)
 		\runsamp_linux_32 (32-bit TPTAPI application built for Linux with
   gcc 4.1)
       \runsamp_linux_64     (64-bit TPTAPI application built for Linux with		
							    gcc 4.1)
       \runsamp_linux_390_32 (32-bit TPTAPI application built for z/Linux 
								with gcc 4.1)
       \runsamp_linux_390_64 (64-bit TPTAPI application built for z/Linux 
								with gcc 4.1)

2 Become familiar with the Teradata PT methods in the sample programs (.cpp files).

3 In the sample makefile, you can see the following settings. Run the makefile to build the samples.

  • C/C++ Additional Include Directories:
  • ../inc  (Teradata PT common headers)
    ./inc   (sample-only header)
    ../common (sample shared files)
  • Linker Additional Library Directories:
  • -ltelapi

    Note: Edit the makefile and modify the values of the C++C and CC variables to the location of the compilers on your system.

    Before running the makefile, verify that the directory containing the Teradata PT ICU Library (libpxicu.so) is in the LD_LIBRARY_PATH environment variable.

    4 Set the following environment variables, if necessary.

    Put the sample executable, data file, Teradata PT .so file in the same directory. Or specify the Teradata PT directory in the PATH variables. Run all 32‑bit executables with 32‑bit .so files and run all 64‑bit executables with 64‑bit .so files. For example:

    a export LD_LIBRARY_PATH = < library path>:$LD_LIBRARY_PATH

    export LD_LIBRARY_PATH=
    =/opt/teradata/client/15.10/tbuild/lib:$LD_LIBRARY_PATH (32-bit)
    export LD_LIBRARY_PATH=
    =/opt/teradata/client/15.10/tbuild/lib64/:$LD_LIBRARY_PATH (64‑bit)

    b export NLSPATH=<directory path of the catalog>/%N:$NLSPATH

    export NLSPATH=
    =/opt/teradata/client/15.10/tbuild/msg/%N:$NLSPATH (32-bit)
    export NLSPATH=
    =/opt/teradata/client/15.10/tbuild/msg/%N:$NLSPATH (64-bit)

    5 Set the CLIv2 environment variable THREADONOFF to one to run the Teradata PT multi-threaded application.

    6 Change the DBS machine name, DBS user name, and DBS user password in the BTEQ scripts setupTables.bteq and cleanupTables.bteq for each sample.

    7 Run the BTEQ script setupTables.bteq to set up the tables for the current sample.

    8 Execute the sample.

    9 Run the BTEQ script cleanupTables.bteq to clean up the tables used by the current sample.

    Note: To execute the precompiled TPTAPI applications available in \sample\runsamp directory:

  • Change your working directory to <TPTAPI install directory>\sample\runsamp.
  • Run the executable that is available in this directory.
  • For example, to run a 32-bit TPTAPI application built on Linux, issue this command at the command prompt:

    ./runsamp_linux_32 tdpid userid password