Notes:
The sample programs come with the DB2 Application Development (DB2 AD) Client. You can use the sample programs as templates to create your own applications.
Sample program file extensions differ for each supported language, and for embedded SQL and non-embedded SQL programs within each language. File extensions may also differ for groups of programs within a language. These different sample file extensions are categorized in the following tables:
The following tables document the sample programs by type:
Notes:
Table 1. Sample File Extensions by Language
Language | Directory | Embedded SQL Programs | Non-embedded SQL Programs |
---|---|---|---|
C |
samples/c samples/cli (CLI programs) | .sqc | .c |
C++ | samples/cpp |
.sqC (UNIX) .sqx (Windows & OS/2) |
.C (UNIX) .cxx (Windows & OS/2) |
COBOL |
samples/cobol samples/cobol_mf | .sqb | .cbl |
JAVA | samples/java | .sqlj | .java |
REXX | samples/rexx | .cmd | .cmd |
Table 2. Sample File Extensions by Program Group
Sample Group | Directory | File Extension |
---|---|---|
ADO, RDO, MTS |
samples\ADO\VB (Visual Basic) samples\ADO\VC (Visual C++) samples\RDO samples\MTS |
.bas .frm .vbp (Visual Basic) .cpp .dsp .dsw (Visual C++) |
CLP | samples/clp | .db2 |
OLE |
samples\ole\msvb (Visual Basic) samples\ole\msvc (Visual C++) |
.bas .vbp (Visual Basic) .cpp (Visual C++) |
OLE DB | samples\oledb | .db2 |
SQL Procedures | samples/sqlproc |
.db2 .c .sqc (Client Applications) |
User Exit | samples/c |
.cad (OS/2) .cadsm (UNIX & Windows) .cdisk (UNIX & Windows) .ctape (UNIX) |
Note: |
|
You can find the sample programs in the samples subdirectory of the directory where DB2 has been installed. There is a subdirectory for each supported language. The following examples show you how to locate the samples written in C or C++ on each supported platform.
You can find the C source code for embedded SQL and DB2 API programs in sqllib/samples/c under your database instance directory; the C source code for DB2 CLI programs is in sqllib/samples/cli. For additional information about the programs in the samples tables, refer to the README file in the appropriate samples subdirectory under your DB2 instance. The README file will contain any additional samples that are not listed in this book.
You can find the C source code for embedded SQL and DB2 API programs in %DB2PATH%\samples\c under the DB2 install directory; the C source code for DB2 CLI programs is in %DB2PATH%\samples\cli. The variable %DB2PATH% determines where DB2 is installed. Depending on the drive where DB2 is installed, %DB2PATH% will point to drive:\sqllib. For additional information about the sample programs in the samples tables, refer to the README file in the appropriate %DB2PATH%\samples subdirectory. The README file will contain any additional samples that are not listed in this book.
The sample programs directory is typically read-only on most platforms. Before you alter or build the sample programs, copy them to your working directory.
Table 3. DB2 API Sample Programs with No Embedded SQL
Sample Program | Included APIs |
---|---|
backrest
C: backrest.c |
|
checkerr
COBOL: checkerr.cbl |
|
cli_info
C: cli_info.c |
|
client
C: client.c
C++: client.C
COBOL: client.cbl |
|
d_dbconf
C: d_dbconf.c
COBOL: d_dbconf.cbl |
|
d_dbmcon
C: d_dbmcon.c
COBOL: d_dbmcon.cbl |
|
db_udcs
C: db_udcs.c
COBOL: db_udcs.cbl |
|
db2mon
C: db2mon.c |
|
dbcat
C: dbcat.c
COBOL: dbcat.cbl |
|
dbcmt
C: dbcmt.c
COBOL: dbcmt.cbl |
|
dbconf
C: dbconf.c
COBOL: dbconf.cbl |
|
dbinst
C: dbinst.c
COBOL: dbinst.cbl |
|
dbmconf
C: dbmconf.c
COBOL: dbmconf.cbl |
|
dbsnap
C: dbsnap.c
COBOL: dbsnap.cbl |
|
dbstart
C: dbstart.c
COBOL: dbstart.cbl |
|
dbstop
C: dbstop.c
COBOL: dbstop.cbl |
|
dcscat
C: dcscat.c
COBOL: dcscat.cbl |
|
dmscont
C: dmscont.c |
|
ebcdicdb
C: ebcdicdb.c
COBOL: ebcdicdb.cbl |
|
migrate
C: migrate.c
COBOL: migrate.cbl |
|
monreset
C: monreset.c
COBOL: monreset.cbl |
|
monsz
C: monsz.c
COBOL: monsz.cbl |
|
nodecat
C: nodecat.c
COBOL: nodecat.cbl |
|
restart
C: restart.c
COBOL: restart.cbl |
|
setact
C: setact.c
COBOL: setact.cbl |
|
setrundg
C: setrundg.c |
|
sws
C: sws.c
COBOL: sws.cbl |
|
utilapi
C: utilapi.c
C++: utilapi.C |
|
Table 4. DB2 API Embedded SQL Sample Programs
Sample Program | Included APIs |
---|---|
asynrlog
C: asynrlog.sqc |
|
autocfg
C: autocfg.sqc
C++: autocfg.sqC |
|
dbauth
C: dbauth.sqc
COBOL: dbauth.sqb |
|
dbstat
C: dbstat.sqc
COBOL: dbstat.sqb |
|
expsamp
C: expsamp.sqc
COBOL: expsamp.sqb |
|
impexp
C: impexp.sqc
COBOL: impexp.sqb |
|
loadqry
C: loadqry.sqc |
|
makeapi
C: makeapi.sqc |
|
rebind
C: rebind.sqc
COBOL: rebind.sqb |
|
rechist
C: rechist.sqc |
|
tabscont
C: tabscont.sqc
COBOL: tabscont.sqb |
|
tabspace
C: tabspace.sqc
COBOL: tabspace.sqb |
|
tload
C: tload.sqc
COBOL: tload.sqb |
|
tspace
C: tspace.sqc
COBOL: tspace.sqb |
|
utilemb
C: utilemb.sqc
C++: utilemb.C |
|
Table 5. Embedded SQL Sample programs with No DB2 APIs
Sample Program Name | Program Description |
---|---|
adhoc | Demonstrates dynamic SQL and the SQLDA structure to process SQL commands
interactively. SQL commands are input by the user, and output
corresponding to the SQL command is returned.
C: adhoc.sqc |
advsql | Demonstrates the use of advanced SQL expressions like CASE, CAST, and
scalar full selects.
C: advsql.sqc ; COBOL: advsql.sqb |
blobfile | Demonstrates the manipulation of a Binary Large Object (BLOB), by reading
a BLOB value from the sample database and placing it in a file. The
contents of this file can be displayed using an external viewer.
C: blobfile.sqc |
columns | Demonstrates the use of a cursor that is processed using dynamic
SQL. This program lists a result set from SYSCAT.COLUMNS under a
desired schema name.
C: columns.sqc |
cursor | Demonstrates the use of a cursor using static SQL.
C: cursor.sqc ; C++: cursor.sqC ; COBOL: cursor.sqb |
delet | Demonstrates static SQL to delete items from a database. |
dynamic | Demonstrates the use of a cursor using dynamic SQL.
C: dynamic.sqc |
joinsql | Demonstrates using advanced SQL join expressions.
C: joinsql.sqc ; COBOL: joinsql.sqb |
largevol | Demonstrates parallel query processing in a partitioned environment, and
the use of an NFS file system to automate the merging of the result
sets. Only available on AIX.
C: largevol.sqc |
lobeval | Demonstrates the use of LOB locators and defers the evaluation of the
actual LOB data.
C: lobeval.sqc ; COBOL: lobeval.sqb |
lobfile | Demonstrates the use of LOB file handles.
C: lobfile.sqc ; COBOL: lobfile.sqb |
lobloc | Demonstrates the use of LOB locators.
C: lobloc.sqc ; COBOL: lobloc.sqb |
lobval | Demonstrates the use of LOBs.
C: lobval.sqc |
openftch | Demonstrates fetching, updating, and deleting of rows using static
SQL.
C: openftch.sqc ; COBOL: openftch.sqb |
recursql | Demonstrates the use of advanced SQL recursive queries.
C: recursql.sqc |
sampudf | Demonstrates User-Defined Types (UDTs) and User-Defined Functions (UDFs)
implemented to modify table entries. All UDFs declared in this program
are sourced UDFs.
C: sampudf.sqc |
spclient | A client application that calls stored procedures in the
spserver shared library.
C: spclient.sqc ; C++: spclient.sqC |
spcreate.db2 | A CLP script that contains the CREATE PROCEDURE statements to register
the stored procedures created by the spserver program.
C/C++: spcreate.db2 |
spdrop.db2 | A CLP script that contains the DROP PROCEDURE statements necessary for
deregistering the stored procedures created by the spserver
program.
C/C++: spdrop.db2 |
spserver | A server program demonstrating stored procedures. The client
program is spclient.
C: spserver.sqc ; C++: spserver.sqC |
static | Demonstrates static SQL to retrieve information.
C: static.sqc ; C++: static.sqC ; COBOL: static.sqb |
tabsql | Demonstrates the use of advanced SQL table expressions.
C: tabsql.sqc ; COBOL: tabsql.sqb |
tbdefine | Demonstrates creating and dropping tables.
C: tbdefine.sqc |
thdsrver | Demonstrates the use of POSIX threads APIs for thread creation and
management. The program maintains a pool of contexts. A
generate_work function is executed from main, and creates dynamic SQL
statements that are executed by worker threads. When a context becomes
available, a thread is created and dispatched to do the specified work.
The work generated consists of statements to delete entries from either the
STAFF or EMPLOYEE tables of the sample database. This
program is only available on UNIX platforms.
C: thdsrver.sqc ; C++: thdsrver.sqC |
trigsql | Demonstrates using advanced SQL triggers and constraints.
C: trigsql.sqc ; COBOL: trigsql.sqb |
udfcli | Demonstrates calling a user-defined function (UDF) created by the
udfsrv program, and stored on the server to access tables in the
sample database.
C: udfcli.sqc ; C++: udfcli.sqC |
updat | Demonstrates static SQL to update a database. |
varinp | Demonstrates variable input to Embedded Dynamic SQL statement calls using
parameter markers.
C: varinp.sqc ; COBOL: varinp.sqb |
Table 6. User-Defined Function Sample programs
Sample Program Name | Program Description |
---|---|
DB2Udf.java
| A Java UDF that demonstrates several tasks, including integer division, manipulation of Character Large Objects (CLOBs), and the use of Java instance variables. |
udfsrv.c
| Creates a library with the User-Defined Function ScalarUDF, to access the sample database tables. |
UDFsrv.java
| Demonstrates the use of Java User-Defined Functions (UDFs). |
Table 7. 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. | ||
|
Table 8. Java Database Connectivity (JDBC) Sample Programs
Sample Program Name | Program Description |
---|---|
DB2Appl.java
| A JDBC application that queries the sample database using the invoking user's privileges. |
DB2Applt.java
| A JDBC applet that queries the database using the JDBC applet driver. It uses the user name, password, server, and port number parameters specified in DB2Applt.html . |
DB2Applt.html
| An HTML file that embeds the applet sample program, DB2Applt . It needs to be customized with server and user information. |
DB2UdCli.java
| A Java client application that calls the Java user-defined function, DB2Udf . |
Dynamic.java
| Demonstrates a cursor using dynamic SQL. |
MRSPcli.java
| This is the client program that calls the server program MRSPsrv. The program demonstrates multiple result sets being returned from a Java stored procedure. |
MRSPsrv.java
| This is the server program that is called by the client program, MRSPcli. The program demonstrates multiple result sets being returned from a Java stored procedure. |
Outcli.java
| A Java client application that calls the SQLJ stored procedure, Outsrv . |
PluginEx.java
| A Java program that adds new menu items and toolbar buttons to the DB2 Web Control Center. |
Spclient.java
| A JDBC client application that calls PARAMETER STYLE JAVA stored procedures in the Spserver stored procedure class. |
Spcreate.db2
| A CLP script that contains the CREATE PROCEDURE statements to register the methods contained in the Spserver class as stored procedures. |
Spdrop.db2
| A CLP script that contains the DROP PROCEDURE statements necessary for deregistering the stored procedures contained in the Spserver class. |
Spserver.java
| A JDBC program demonstrating PARAMETER STYLE JAVA stored procedures. The client program is Spclient.java . |
UDFcli.java
| A JDBC client application that calls functions in the Java user-defined function library, UDFsrv . |
UseThrds.java
| Shows how to use threads to run an SQL statement asynchronously (JDBC version of CLI sample async.c). |
V5SpCli.java
| A Java client application that calls the DB2GENERAL stored procedure, V5Stp.java . |
V5Stp.java
| Demonstrates a DB2GENERAL stored procedure that updates the EMPLOYEE table on the server, and returns new salary and payroll information to the client. The client program is V5SpCli.java . |
Varinp.java
| Demonstrates variable input to Embedded Dynamic SQL statement calls using parameter markers. |
Table 9. Embedded SQL for Java (SQLJ) Sample Programs
Sample Program Name | Program Description |
---|---|
App.sqlj
| Uses static SQL to retrieve and update data from the EMPLOYEE table of the sample database. |
Applt.sqlj
| An applet that queries the database using the JDBC applet driver. It uses the user name, password, server, and port number parameters specified in Applt.html . |
Applt.html
| An HTML file that embeds the applet sample program, Applt . It needs to be customized with server and user information. |
Cursor.sqlj
| Demonstrates an iterator using static SQL. |
OpF_Curs.sqlj
| Class file for the Openftch program. |
Openftch.sqlj
| Demonstrates fetching, updating, and deleting rows using static SQL. |
Outsrv.sqlj
| Demonstrates a stored procedure using the SQLDA structure. It fills the SQLDA with the median salary of the employees in the STAFF table of the sample database. After the database processing (finding the median), the stored procedure returns the filled SQLDA and the SQLCA status to the JDBC client application, Outcli . |
Stclient.sqlj
| An SQLJ client application that calls PARAMETER STYLE JAVA stored procedures created by the SQLJ stored procedure program, Stserver . |
Stcreate.db2
| A CLP script that contains the CREATE PROCEDURE statements to register the methods contained in the Stserver class as stored procedures. |
Stdrop.db2
| A CLP script that contains the DROP PROCEDURE statements necessary for deregistering the stored procedures contained in the Stserver class. |
Stserver.sqlj
| An SQLJ program demonstrating PARAMETER STYLE JAVA stored procedures. The client program is Stclient.sqlj . |
Static.sqlj
| Uses static SQL to retrieve information. |
Stp.sqlj
| A stored procedure that updates the EMPLOYEE table on the server, and returns new salary and payroll information to the JDBC client program, StpCli . |
UDFclie.sqlj
| A client application that calls functions from the Java user-defined function library, UDFsrv . |
Updat.sqlj
| Uses static SQL to update a database. |
Table 10. SQL Procedure Sample Programs
Sample Program Name | Program Description |
---|---|
basecase.db2 | The UPDATE_SALARY procedure raises the salary of an employee identified by the "empno" IN parameter in the "staff" table of the "sample" database. The procedure determines the raise according to a CASE statement that uses the "rating" IN parameter. |
basecase.sqc | Calls the UPDATE_SALARY procedure. |
baseif.db2 | The UPDATE_SALARY_IF procedure raises the salary of an employee identified by the "empno" IN parameter in the "staff" table of the "sample" database. The procedure determines the raise according to an IF statement that uses the "rating" IN parameter. |
baseif.sqc | Calls the UPDATE_SALARY_IF procedure. |
dynamic.db2 | The CREATE_DEPT_TABLE procedure uses dynamic DDL to create a new table. The name of the table is based on the value of the IN parameter to the procedure. |
dynamic.sqc | Calls the CREATE_DEPT_TABLE procedure. |
iterate.db2 | The ITERATOR procedure uses a FETCH loop to retrieve data from the "department" table. If the value of the "deptno" column is not 'D11', modified data is inserted into the "department" table. If the value of the "deptno" column is 'D11', an ITERATE statement passes the flow of control back to the beginning of the LOOP statement. |
iterate.sqc | Calls the ITERATOR procedure. |
leave.db2 | The LEAVE_LOOP procedure counts the number of FETCH operations performed in a LOOP statement before the "not_found" condition handler invokes a LEAVE statement. The LEAVE statement causes the flow of control to exit the loop and complete the stored procedure. |
leave.sqc | Calls the LEAVE_LOOP procedure. |
loop.db2 | The LOOP_UNTIL_SPACE procedure counts the number of FETCH operations performed in a LOOP statement until the cursor retrieves a row with a space (' ') value for column "midinit". The loop statement causes the flow of control to exit the loop and complete the stored procedure. |
loop.sqc | Calls the LOOP_UNTIL_SPACE procedure. |
nestcase.db2 | The BUMP_SALARY procedure uses nested CASE statements to raise the salaries of employees in a department identified by the dept IN parameter from the "staff" table of the "sample" database. |
nestcase.sqc | Calls the BUMP_SALARY procedure. |
nestif.db2 | The BUMP_SALARY_IF procedure uses nested IF statements to raise the salaries of employees in a department identified by the dept IN parameter from the "staff" table of the "sample" database. |
nestif.sqc | Calls the BUMP_SALARY_IF procedure. |
repeat.db2 | The REPEAT_STMT procedure counts the number of FETCH operations performed in a repeat statement until the cursor can retrieve no more rows. The condition handler causes the flow of control to exit the repeat loop and complete the stored procedure. |
repeat.sqc | Calls the REPEAT_STMT procedure. |
rsultset.c | Calls the MEDIAN_RESULT_SET procedure, displays the median salary, then displays the result set generated by the SQL procedure. This client is written using the CLI API, which can accept result sets. |
rsultset.db2 | The MEDIAN_RESULT_SET procedure obtains the median salary of employees in a department identified by the "dept" IN parameter from the "staff" table of the "sample" database. The median value is assigned to the salary OUT parameter and returned to the "rsultset" client. The procedure then opens a WITH RETURN cursor to return a result set of the employees with a salary greater than the median. The procedure returns the result set to the client. |
spserver.db2 | The SQL procedures in this CLP script demonstrate basic error-handling, nested stored procedure calls, and returning result sets to the client application or the calling application. You can call the procedures using the "spcall" application, in the CLI samples directory. You can also use the "spclient" application, in the C and CPP samples directories, to call the procedures that do not return result sets. |
whiles.db2 | The DEPT_MEDIAN procedure obtains the median salary of employees in a department identified by the "dept" IN parameter from the "staff" table of the "sample" database. The median value is assigned to the salary OUT parameter and returned to the "whiles" client. The whiles client then prints the median salary. |
whiles.sqc | Calls the DEPT_MEDIAN procedure. |
Table 11. ADO, RDO, and MTS Sample Programs
Sample Program Name | Program Description |
---|---|
Bank.vbp | An RDO program to create and maintain data for bank branches, with the ability to perform transactions on customer accounts. The program can use any database specified by the user as it contains the DDL to create the necessary tables for the application to store data. |
Blob.vbp | This ADO program demonstrates retrieving BLOB data. It retrieves and displays pictures from the emp_photo table of the sample database. The program can also replace an image in the emp_photo table with one from a local file. |
BLOBAccess.dsw | This sample demonstrates highlighting ADO/Blob access using Microsoft
Visual C++. It is similar to the Visual Basic sample,
Blob.vbp. The BLOB sample has two main
functions:
|
Connect.vbp | This ADO program will create a connection object, and establish a connection, to the sample database. Once completed, the program will disconnect and exit. |
Commit.vbp | This application demonstrates the use of autocommit/manual-commit features of ADO. The program queries the EMPLOYEE table of the sample database for employee number and name. The user has an option of connecting to the database in either autocommit or manual-commit mode. In the autocommit mode, all of the changes that a user makes on a record are updated automatically in the database. In the manual-commit mode, the user needs to begin a transaction before he/she can make any changes. The changes made since the beginning of a transaction can be undone by performing a rollback. The changes can be saved permanently by committing the transaction. Exiting the program automatically rolls back the changes. |
db2com.vbp | This Visual Basic project demonstrates updating a database using the
Microsoft Transaction Server. It creates a server DLL used by the
client program, db2mts.vbp, and has four class
modules:
|
db2mts.vbp | This is a Visual Basic project for a client program that uses the Microsoft Transaction Server to call the server DLL created from db2com.vbp. |
Select-Update.vbp | This ADO program performs the same functions as Connect.vbp, but also provides a GUI interface. With this interface, the user can view, update, and delete data stored in the ORG table of the sample database. |
Sample.vbp | This Visual Basic project uses Keyset cursors via ADO to provide a graphical user interface to all data in the sample database. |
VarCHAR.dsp | A Visual C++ program that uses ADO to access VarChar data as textfields. It provides a graphical user interface to allow users to view and update data in the ORG table of the sample database. |
Table 12. Object Linking and Embedding (OLE) Sample Programs
Sample Program Name | Program Description |
---|---|
sales | Demonstrates rollup queries on a Microsoft Excel sales spreadsheet (implemented in Visual Basic). |
names | Queries a Lotus Notes address book (implemented in Visual Basic). |
inbox | Queries Microsoft Exchange inbox e-mail messages through OLE/Messaging (implemented in Visual Basic). |
invoice | An OLE automation user-defined function that sends Microsoft Word invoice documents as e-mail attachments (implemented in Visual Basic). |
bcounter | An OLE automation user-defined function demonstrating a scratchpad using instance variables (implemented in Visual Basic). |
ccounter | A counter OLE automation user-defined function (implemented in Visual C++). |
salarysrv | An OLE automation stored procedure that calculates the median salary of the STAFF table of the sample database (implemented in Visual Basic). |
salarycltvc | A Visual C++ embedded SQL sample that calls the Visual Basic stored procedure, salarysrv. |
salarycltvb | A Visual Basic DB2 CLI sample that calls the Visual Basic stored procedure, salarysrv. |
testcli | An OLE automation embedded SQL client application that calls the stored procedure, tstsrv (implemented in Visual C++). |
tstsrv | An OLE automation stored procedure demonstrating the passing of various types between client and stored procedure (implemented in Visual C++). |
Table 13. Object Linking and Embedding Database (OLE DB) Table Functions
Sample Program Name | Program Description |
---|---|
jet.db2 | Microsoft.Jet.OLEDB.3.51 Provider |
mapi.db2 | INTERSOLV Connect OLE DB for MAPI |
msdaora.db2 | Microsoft OLE DB Provider for Oracle |
msdasql.db2 | Microsoft OLE DB Provider for ODBC Drivers |
msidxs.db2 | Microsoft OLE DB Index Server Provider |
notes.db2 | INTERSOLV Connect OLE DB for Notes |
sampprov.db2 | Microsoft OLE DB Sample Provider |
sqloledb.db2 | Microsoft OLE DB Provider for SQL Server |
Table 14. Command Line Processor (CLP) Sample Programs.
Sample File Name | File Description |
---|---|
const.db2 | Creates a table with a CHECK CONSTRAINT clause. |
cte.db2 | Demonstrates a common table expression. The equivalent sample program demonstrating this advanced SQL statement is tabsql. |
flt.db2 | Demonstrates a recursive query. The equivalent sample program demonstrating this advanced SQL statement is recursql. |
join.db2 | Demonstrates an outer join of tables. The equivalent sample program demonstrating this advanced SQL statement is joinsql. |
stock.db2 | Demonstrates the use of triggers. The equivalent sample program demonstrating this advanced SQL statement is trigsql. |
testdata.db2 | Uses DB2 built-in functions such as RAND() and TRANSLATE() to populate a table with randomly generated test data. |
thaisort.db2 | This script is particularly for Thai users. Thai sorting is by phonetic order requiring pre-sorting/swapping of the leading vowel and its consonant, as well as post-sorting in order to view the data in the correct sort order. The file implements Thai sorting by creating UDF functions presort and postsort, and creating a table; then it calls the functions against the table to sort the table data. To run this program, you first have to build the user-defined function program, udf, from the C source file, udf.c. |
Table 15. Log Management User Exit Sample Programs.
Sample File Name | File Description |
---|---|
db2uext2.cadsm | This is a sample User Exit utilizing ADSTAR DSM ( ADSM ) APIs to archive and retrieve database log files. The sample provides an audit trail of calls (stored in a separate file for each option) including a timestamp and parameters received. It also provides an error trail of calls in error including a timestamp and an error isolation string for problem determination. These options can be disabled. The file must be renamed db2uext2.c and compiled as a C program. Available on UNIX and Windows 32-bit operating systems. The OS/2 version is db2uexit.cad. |
db2uexit.cad | This is the OS/2 version of db2uext2.cadsm. The file must be renamed db2uexit.c and compiled as a C program. |
db2uext2.cdisk | This is a sample User Exit utilizing the system copy command for the particular platform on which it ships. The program archives and retrieves database log files, and provides an audit trail of calls (stored in a separate file for each option) including a timestamp and parameters received. It also provides an error trail of calls in error including a timestamp and an error isolation string for problem determination. These options can be disabled. The file must be renamed db2uext2.c and compiled as a C program. Available on UNIX and Windows 32-bit operating systems. |
db2uext2.ctape | This is a sample User Exit utilizing system tape commands for the particular UNIX platform on which it ships. The program archives and retrieves database log files. All limitations of the system tape commands are limitations of this user exit. The sample provides an audit trail of calls (stored in a separate file for each option) including a timestamp and parameters received. It also provides an error trail of calls in error including a timestamp and an error isolation string for problem determination. These options can be disabled. The file must be renamed db2uext2.c and compiled as a C program. Available on UNIX platforms only. |