Call Level Interface Guide and Reference


Appendix J. CLI Sample Code

This appendix lists all the sample DB2 CLI programs, including those demonstrated in this book. The samples can be found on OS/2 and Windows 32-bit operating systems in sqllib\samples\cli, and on UNIX platforms in sqllib/samples/cli. The README file contains a complete description of each file, and describes how to use the makefile and build scripts to build all the samples.

There is an HTML cross reference table available that lists each CLI function, along with the complete list of samples that call that function. See the file funcxref.htm in sqllib\doc\html\db2hs\cli\ on OS/2 and Windows 32-bit operating systems, and in sqllib/doc/html/db2hs/cli/ on UNIX platforms.

The following table lists all the DB2 CLI sample programs.

Table 216. Sample CLI Programs in DB2 Universal Database
Sample Program Name Program Description
Common Utility Files
utilcli.c
Utility functions used in CLI samples.
utilapi.c
Utility functions that call DB2 APIs.
Application Level - Samples that deal with the application level of DB2 and CLI.
apinfo.c
How to get and set application level information.
aphndls.c
How to allocate and free handles.
apsqlca.c
How to work with SQLCA data.
Installation Image Level - Samples that deal with the installation image level of DB2 and CLI.
ilinfo.c
How to get and set installation level information (such as the version of the CLI driver).
Instance Level - Samples that deal with the instance level of DB2 and CLI.
ininfo.c
How to get and set instance level information.
Database Level - Samples that deal with database objects in DB2.
dbconn.c
How to connect and disconnect from a database.
dbinfo.c
How to get and set information at a database level.
dbmconn.c
How to connect and disconnect from multiple databases (uses DB2 APIs to create and drop second database).
dbmuse.c
How to perform transactions with multiple databases (uses DB2 APIs to create and drop second database).
dbnative.c
How to translate a statement that contains an ODBC escape clause to a data source specific format.
dbuse.c
How to work with database objects.
dbusemx.sqc
How to use a single database in conjunction with embedded SQL.
Table Level - Samples that deal with table objects in DB2.
tbconstr.c
How to work with table constraints.
tbconstr.c
How to create, alter and drop tables.
tbinfo.c
How to get and set information at a table level.
tbmod.c
How to modify information in a table.
tbread.c
How to read information in a table.
Data Type Level - Samples that deal with data types.
dtinfo.c
How to get information about data types.
dtlob.c
How to read and write LOB data.
dtudt.c
How to create, use, and drop user defined distinct types.
UDF Level - Samples that demonstrate user defined functions.
udfcli.c
Client application which calls the user defined function in udfsrv.c.
udfsrv.c
User defined function ScalarUDF called by udfcli.c sample.
Stored Procedure Level - Samples that demonstrate stored procedures in CLI.
spcreate.db2 CLP script to issue CREATE PROCEDURE statements.
spdrop.db2 CLP script to drop stored procedures from the catalog.
spclient.c
Client program used to call the server functions declared in spserver.c.
spserver.c
Stored procedure functions built and run on the server.
spcall.c
Program to call any stored procedure.
Note:Other files in the samples/cli directory include:
  • README - Lists all example files.
  • makefile - Makefile for all files
  • build files for applications and stored procedures

The following two example files are listed in this section.:


[ Top of Page | Previous Page | Next Page ]