C samples
UNIX directory: sqllib/samples/c
. Windows
directory: sqllib\samples\c
.
File extensions: .c
(no embedded SQL); .sqc
(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 get a snapshot at instance level (using API). | |
instart.c |
How to stop and start the current local instance. | |
Database level | autostore.c |
How to use automatic storage capability for a database. |
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 history 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 on Windows. | |
dblognoconn.sqc |
How to read database log files asynchronously with no database connection on 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. | |
dbredirect.sqc |
How to perform Redirected Restore of a database. | |
dbrestore.sqc |
How to restore a database from a backup. | |
dbrollfwd.sqc |
How to perform rollforward after a restore of a database. | |
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 get a snapshot at 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. | |
implicitcasting.sqc |
How to use implicit casting. | |
dbuse.sqc |
How to use database objects. | |
getlogs.sqc |
How to get customer view of diagnostic log file entries. | |
globvarsupport.sqc |
How to create and delete global variables and use global variables in triggers and stored procedures. | |
ssv_backup_db.c |
How to run the BACKUP DATABASE command to back up all partitions of a multi-partition database at once. | |
ssv_backup_tbsp.sqc |
How to perform a tablespace backup on a multi-partition database. | |
ssv_db_cfg.c |
How to update database configuration parameters across multiple partitions in a partitioned database environment. | |
Table space level | tscreate.sqc |
How to create and drop buffer pools and table spaces. |
Table level | getmessage.sqc |
How to get error message in the required locale with token replacement. |
largerid.sqc |
How to enable Large RIDs support on both new tables/tablespaces and existing tables/tablespaces. | |
setintegrity.sqc |
How to perform online SET INTEGRITY on a table. | |
tbast.sqc |
How to use a staging table for updating a deferred Automatic Summary Table. | |
tbcompress.sqc |
How to create tables with null and default value compression options. | |
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. | |
tbload.sqc |
How to load into a partitioned database. | |
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. | |
tbonlineinx.sqc |
How to create and reorganize indexes on a table. | |
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. | |
tbrowcompress.sqc |
How to perform row compression on a table. | |
tbrunstats.sqc |
How to perform runstats on a table. | |
tbsavept.sqc |
How to use external savepoints. | |
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. | |
tbumqt.sqc |
How to use user materialized query tables (summary tables). | |
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. | |
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 |
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 | |
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. |