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/64-bit .dylib files)
\inc (containS .h files)
\blockloading (shows how to load rows in buffer mode with the load
\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)
\runsamp (contains precompiled TPTAPI applications)
\runsamp_macos_32 (32-bit TPTAPI application built for OS X with
\runsamp_macos_64 (64-bit TPTAPI application built for OS X with
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 point to the location of the respective compilers on your system.
Before running the makefile, verify that the directory containing the Teradata PT ICU Library (libpxicu.dylib) is in the DYLD_LIBRARY_PATH environment variable.
4 Set the following environment variables, if necessary:
Put the sample executable data file, Teradata PT .dylib, in the same directory, or specify the Teradata PT directory in the PATH variables.
Run all 32-bit executables with 32-bit .dylib files.
Run all 64-bit executables with 64-bit .dylib files.
1. export DYLD_LIBRARY_PATH=<library path>:$DYLD_LIBRARY_PATH, as in the following examples:
export DYLD_LIBRARY_PATH=/opt/teradata/client/15.10/tbuild/ lib:$DYLD_LIBRARY_PATH 32-bit/64-bit)
2. export NLSPATH=<directory path of the catalog>/%N:$NLSPATH, as in the following examples:
export NLSPATH=/opt/teradata/client/15.10/tbuild/msg/%N:$NLSPATH (32-bit/64-bit)
5 Set the CLIv2 environment variable THREADONOFF to 1 (one) to run the Teradata PT multi-threaded application.
6 Change the DBS database 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 application that is completed in step 3.
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:
For example, to run a 32-bit TPTAPI application built on OS X, issue the following command at the prompt:
./runsamp_macos_32 tdpid userid password