UNIX directory: sqllib/samples/cpp. Windows directory: sqllib\samples\cpp.
UNIX file extensions: .C (no embedded SQL); .sqC (embedded SQL)
Windows file extensions: .cxx (no embedded SQL); .sqx (embedded SQL)
Type of sample | Sample program name | Program description |
---|---|---|
Client level | cli_info.C | How to get and set client level information. |
clisnap.C | How to capture a snapshot at the client level. | |
clisnapnew.C | How to get a snapshot at the client level (using API). | |
Instance level | inattach.C | How to attach to/detach from an instance. |
ininfo.C | How to get and set instance level information. | |
insnap.C | How to capture a snapshot at the instance level. | |
insnapnew.C | How to capture a snapshot at the instance level. (using API). | |
instart.C | How to stop and start the current local instance. | |
Database level | dbcfg.sqC | How to configure database and database manager parameters. |
dbconn.sqC | How to connect and disconnect from a database. | |
dbcreate.C | How to create and drop databases. | |
dbhistfile.sqC | How to read and update a database recovery file entry. | |
dbinfo.C | How to get and set information at a database level. | |
dbinline.sqC | How to use inline SQL procedure language. | |
dbinspec.sqC | How to check architectural integrity with the DB2 API db2Inspect. | |
dblogconn.sqC | How to read database log files asynchronously with a database connection. | |
dblognoconn.sqC | How to read database log files asynchronously with no database connection in Windows. | |
dblognoconn.sqC | How to read database log files asynchronously with no database connection in UNIX. | |
dbmcon.sqC | How to connect to and disconnect from multiple databases. | |
dbmcon1.h | Header file for dbmcon1.sqC | |
dbmcon1.sqC | Support file for dbmcon.sqC. | |
dbmcon2.h | Header file for dbmcon2.sqC | |
dbmcon2.sqC | Support file for dbmcon.sqC. | |
dbpkg.sqC | How to work with packages. | |
dbrecov.sqC | How to recover a database. | |
dbrestore.sqC | How to recover a database. | |
dbrollfwd.sqC | How to recover a database using rollforward recovery. | |
dbsample.sqC | How to create the sample database including Host and AS/400 tables and views. | |
dbsnap.C | How to capture a snapshot at the database level. | |
dbsnapnew.C | How to capture a snapshot at the database level. (using API) | |
dbthrds.sqC | How to use multiple context APIs on UNIX. | |
dbthrds.sqC | How to use multiple context APIs on Windows. | |
dbupgrade.C | How to upgrade a database. | |
dbuse.sqC | How to use database objects. | |
Table space level | tscreate.sqC | How to create and drop buffer pools and table spaces. |
Table level | tbconstr.sqC | How to work with table constraints. |
tbcreate.sqC | How to create, alter and drop tables. | |
tbident.sqC | How to use identity columns. | |
tbinfo.sqC | How to get and set information at a table level. | |
tbintrig.sqC | How to use an 'INSTEAD OF' trigger on a view. | |
tbloadcursor.sqC | How to load data returned from a SELECT statement into a table using CURSOR method or REMOTEFETCH media method. | |
tbmerge.sqC | How to use the MERGE statement. | |
tbmod.sqC | How to modify information in a table. | |
tbmove.sqC | How to move a table data. | |
tbpriv.sqC | How to grant/display/revoke table level privileges. | |
tbread.sqC | How to read information in a table. | |
tbreorg.sqC | How to reorganize a table. | |
tbsavept.sqC | How to use external savepoints. Also demonstrates how to change the default value of a column. | |
tbsel.sqC | How to select from each of: insert, update, delete. | |
tbselcreate.db2 | How to create the tables for the tbsel program. | |
tbseldrop.db2 | How to drop the tables for the tbsel program. | |
tbtemp.sqC | How to use a declared temporary table. | |
tbtrig.sqC | How to use a trigger on a table. | |
tbunion.sqC | How to insert through a UNION ALL view. | |
Data type level | dtformat.sqC | How to use load and import data format extensions. |
dtlob.sqC | How to read and write LOB data. | |
dtstruct.sqC | How to create, use, and drop a hierarchy of structured types and typed tables. | |
dtudt.sqC | How to create, use, and drop user-defined distinct types. | |
DB2 function level | fnuse.sqC | How to use SQL functions. |
Stored procedure level | 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.sqC | Client program used to call the server routines declared in spserver.sqc, spserver.sqC. | |
spserver.sqC | Stored procedure routines built and run on the server. | |
UDF level | udfcli.sqC | Client application which calls the user-defined function in udfsrv.c, udfsrv.C. |
udfsrv.C | User-defined function ScalarUDF called by udfcli.sqc, udfcli.sqC. | |
udfemcli.sqC | Client application which calls the embedded SQL user defined function library udfemsrv. | |
udfemsrv.sqC | Embedded SQL User-defined function library called by udfemcli. | |
Other | evm.sqC | How to create and parse file, pipe, and table event monitors. |
utilrecov.C | Utilities for the backup, restore and log file samples. | |
utilsnap.C | Utilities for the snapshot monitor samples. |