The DB2 SDK comes with sample programs that use DB2 Call Level Interface (DB2 CLI) function calls. You can study the samples to learn how to access DB2 databases in your applications using DB2 CLI function calls. You can also use stored procedures with DB2 CLI. For information on DB2 CLI stored procedures refer to the CLI Guide and Reference.
This chapter shows you how to build and run a sample program using a script file we supply. The script file shows you the compiler options you can use. It builds the sample program by compiling and linking the source file.
The sample programs and a makefile are contained in the sqllib/samples/cli directory. You can build the sample programs using the make facility. See the README file in sqllib/samples/cli for details about using the makefile, and for more information about the sample programs. You may need to modify the compiler options in the script file and the makefile for your environment.
Once you have compiled and run the supplied sample programs, you can modify the source files, and the makefile, for your own needs. You can then build the modified sample programs by using the makefile to see if they work correctly. You can also build your own programs using the makefile. All the sample programs are listed in Table 6.
Note: | It is recommended that, before you alter or build the sample programs, you copy them from sqllib/samples/cli to your own working directory. |