DB2 10.5 for Linux, UNIX, and Windows

CLI samples

UNIX directory: sqllib/samples/cli. Windows directory: sqllib\samples\cli.

Table 1. Sample CLI program files
Type of sample Sample program name Program description
ADMIN_CMD samples - Programs that demonstrate the use of ADMIN_CMD stored procedure for performing administration tasks admincmd_autoconfigure.c How to autoconfigure a database using ADMIN_CMD routine
admincmd_contacts.c How to add, update and drop contacts and contactgroups using ADMIN_CMD routine
admincmd_export.c How to export data using ADMIN_CMD routine.
admincmd_import.c How to import data using ADMIN_CMD routine.
admincmd_describe.c How to describe table and indices using ADMIN_CMD routine.
admincmd_quiesce.c How to quiesce tablespaces and database using ADMIN_CMD routine.
admincmd_onlinebackup.c How to perform online backup using ADMIN_CMD routine.
admincmd_updateconfig.c How to update and reset the Database configuration and Database Manager Configuration Parameters using ADMIN_CMD routine.
Installation image level - Samples that deal with the DB2 and CLI installation image level. ilinfo.c How to get and set installation level information (such as the version of the CLI driver).
Client level - Samples that deal with the client level. cli_info.c How to get and set client level information.
clihandl.c How to allocate and free handles.
clisqlca.c How to work with SQLCA data.
Instance level - Samples that deal with the instance level. getdbmcfgparams.c How to get Database Manager Configuration parameters.
ininfo.c How to get and set instance level information.
Database level - Samples that deal with database objects. dbcongui.c How to connect to a database with a Graphical User Interface (GUI).
dbconn.c How to connect and disconnect from a database.
dbinfo.c How to get and set information at a database level.
dbmcon.c How to connect and disconnect from multiple databases.
dbmconx.c How to connect and disconnect from multiple databases with embedded SQL.
dbmconx1.h Header file for dbmconx1.sqc.
dbmconx1.sqc Embedded SQL file for the dbmconx program.
dbmconx2.h Header file for dbmconx2.sqc.
dbmconx2.sqc Embedded SQL file for the dbmconx program.
dbnative.c How to translate a statement that contains an ODBC escape clause to a data source specific format.
dbuse.c How to use database objects.
dbusemx.sqc How to use database objects with embedded SQL.
dbxamon.c How to show and roll back indoubt transactions.
getdbcfgparams.c How to get Database Configuration parameters.
ssv_db_cfg.c How to update database configuration parameters across multiple partitions in a partitioned database environment.
trustedcontext.c How to create a trusted context, identify and use a trusted connection for switching user IDs, and acquire trusted context-specific privileges.
Table level - Samples that deal with table objects. getmessage.c How to get error message in the required locale with token replacement.
tbast.c How to use staging table for updating deferred AST.
tbcompress.c How to create tables with null and default value compression option.
tbconstr.c How to work with table constraints.
tbcreate.c How to create, alter, and drop tables.
tbinfo.c How to get and set information at a table level.
tbload.c How to insert data using the CLI LOAD utility.
tbmod.c How to modify information in a table.
tbonlineinx.c How to create and reorg indexes on a table.
tbread.c How to read information in a table.
tbrunstats.c How to perform runstats on a table.
tbtemp.c How to use a declared temporary table.
tbumqt.c How to use user materialized query tables (summary tables).
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.
Stored procedure level - Samples that demonstrate stored procedures. spcat Stored procedure catalog script for the spserver program. This script calls spdrop.db2 and spcreate.db2 in UNIX.
spcat Stored procedure catalog script for the spserver program. This script calls spdrop.db2 and spcreate.db2 in Windows
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.
spclires.c Client application that demonstrates the difference between SQLMoreResults and SQLNextResults for multiple result sets.
spcall.c Client program for calling any stored procedure.
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.
Common utility files utilcli.c Utility functions used in CLI samples.
utilcli.h Header file for utility functions used in CLI samples.