Yanrong Liu |
The CLI Developer's Kit for Windows 9X/NT is a complete implementation of the Call-Level Interface (CLI) for Microsoft Windows. The CLI Developer's Kit enables you to communicate with the Teradata RDBMS through:
Microsoft Dynamic Data Exchange (DDE) applications, such as Microsoft Excel, Asymetrix Toolbook , or Softbridge Bridge
User-written DDE applications that talk directly to the WinCLI.exe, the DDE server (called WinCLI)
Windows Dynamic Link Library (DLL) applications written using Microsoft Visual Basic ® or Microsoft Visual C++ .
User-written DBCPrims DLL applications that talk directly to the DBCPrims.dll User-written CLIv2 DLL applications that talk directly to WinCLI32.dll (called CLI for Windows)
User-written Blob DDE applications that talk to WinCLI.exe and
Blobdll.dll. Sample Blob application (BlobSamp.exe) that talks to DBCPrims.dll
and Blobdll.dll
Major Components and Features
CLI Developer's Kit for Windows 9X/NT includes the following major components
and features:
DDE Primitives Dynamic Data Exchange (DDE) primitives that
provide access to the Teradata RDBMS data from a Windows application such as
Microsoft Excel. DDE is a messaging protocol in the Windows environment that
allows two consenting applications to communicate and exchange data. For
example, an Excel spreadsheet can contain DDE calls that contain SQL in the form
of a text string. The DDE mechanism will pass the SQL to CLI for Windows 9X/NT
and return the results of the SQL query to the Excel spreadsheet. In this way, a
spreadsheet will always use the latest data from the corporate data warehouse
when calculating results for analysis.
1) CLI Implemented for Windows Through DLLs
Dynamic Link Libraries (DLLs)
are a popular mechanism for constructing applications in Windows so that the
entire application does not have to be pre-linked and static.
2) High-Level
Primitives, Implemented as DLLs
Using high level primitives, implemented as
DLLs, rather than using low-level primitives directly, makes it easier to
develop CLI applications accessing the Teradata RDBMS.
3) Sample Windows
Applications
Examples of how to access information in the Teradata RDBMS from
such applications as Microsoft Excel, Asymetrix ToolBook, Softbridge Bridge Tool
Kit, and Microsoft Visual Basic are included in the CLI Developer's Kit. The
examples can be used with minor modification. They can also be used as examples
by programmers writing their own applications from scratch.
4)
BlobSrvr
The Teradata Binary Large Object Server (BlobSrvr) allows storage of
arbitrarily-sized binary objects on the Teradata RDBMS. The BlobSrvr breaks
large objects into smaller pieces for storage on the Teradata RDBMS and tracks
the pieces so that the objects can be automatically reassembled when retrieved
from the database.
5) CLI User Exits
CLI user logon, pre-and
post-processing exits, which have been added to CLI, allow programmers to add
their own code at specified places in the processing stream. For example,
customers can use the exits to execute site-specific user verification and
security routines. The exits are included in the CLI implementation in the
Windows environment.
DDE sample applications These sample applications are for use with some of the more common end-user applications such as Microsoft Excel, Asymetrix ToolBook, and Softbridge Bridge, all of which use Dynamic Data Exchange (DDE).
DLL sample applications These sample applications use CLI implemented as DDLs with Visual Basic or Microsoft Visual C++.
A Blob sample application (BlobSamp.exe) Note: LoadData.exe, a Windows program that is part of the CLI Developer's Kit, creates and loads the sample database tables.
Runtime interface for Windows The Runtime interface includes the DDE server (WinCLI.exe), the primitives library (DBCPrims.dll), the Blob Server (BlobSrvr.exe), and the Blob library (Blobdll.dll)
CLI module The CLI module includes the WinCLI32.dll (called CLI for Windows) which is required to run applications that make CLI calls, but does not make use of the higher-level primitives or DDE server capability, and the tdusr.dll.
Logical Structure

Figure 1 Logical Structure
1) DDE Applications If you are creating your own low-level CLI for Windows applications, see "Using WinCLI With DDE Applications".
2) DLL Applications If you are creating your own DLL applications using the DBCPrims library, see "Using CLI for Windows With DLL Applications."
Creating the Sample Tables
If you plan to run any of the sample programs included with the CLI Developer's Kit, you should create and load the sample tables in your default database on the Teradata RDBMS. 1) For the Database Administrator The sample programs described in this book (ExSample, Adhoc, TBSample, BRSample, and CSamp) access tables in the user's default database. The sample programs depend on the default database containing the sample tables.
2)The LoadData ProgramA
Windows program, LoadData.exe, which creates and loads the sample database tables in the currently defined default database, is included on the CLI Developer's Kit installation diskettes. If you selected to install the LoadData program, it should be located in the LoadData subdirectory of the directory in which you installed WinCLI. These scripts are BTEQ-compatible, and BTEQ can be used to run the scripts, if preferred. The LoadData program assumes that the user's Teradata RDBMS account is set to the appropriate database in which the tables are to be created. Because having several users share a common database can affect the results of the sample programs, you should make a separate copy of the database tables for each user.
Whatever database name you create, it should be the user's default database because of the limitation on database names. For clarity, the documentation uses ExSample, Personnel, and Retail as standard database names to refer to each set of tables created in the user's default database.
Running the LoadData Program
To run the LoadData program, follow these steps:
1 Start the program from the Program Manager window. The Teradata RDBMS logon dialog appears.
2 Logon to the Teradata RDBMS using the user ID for the user whose default database is to contain the new tables.
Enter the user ID.
Enter password.
Select OK.
3 After log on is complete, select Load from the File menu.
4 Select the name of the script you want to run.
5 Select OK.
The scripts you want to run depend on the examples that the user plans to run:
If the user plans to run ExSample, BRSample, or CSamp, you should run the Create script.
If the user plans to run Adhoc, you should run the Personnel script.
If the user plans to run TBSample, you should run the Retail and RetData scripts (in that order).
All the scripts have the file extension .SQL. Each script only needs to be run once, so if you want to run CSamp, for example, you would execute the Create script.
If you later want to run BRSample, you don't need to run any script, because you previously ran the Create script. The scripts drop each table before creating it, so you may get an error if a table has not yet been created. If you receive an error, ignore it by selecting the OK button in the error message box. If you select Cancel, the LoadData program will stop loading that script.When you're finished running the necessary scripts, select the Exit option from the File menu. This will log you off the Teradata RDBMS and close the LoadData application window.
Installing the CLI User Exit Features
Important: The following procedures assume the User Exit files have been installed. If they have not, see the Teradata Client for Windows User's Guide. To install CLI User Exit features, follow these steps:
1 Start Visual C++ and open the project "TDUSR32.MAK". By default this is located in the directory: c:\teradata\cli\lib
2 Modify the cliLgnex.c and CLIPPS.C files, as needed. For more information on the CLI User Exit features, refer to the comments in these files and the Teradata Call-Level Interface, Version2 for Network-Attached Systems.
3 Compile the clignex.c and CLIPPS.C files to build tdusr2.DLL. It may be necessary to modify the include and library directories.
4 Copy tdusr2.DLL to the Windows system directory.