Each DB2 SDK includes sample programs that embed SQL statements. Chapters 4 through 8 explain how to build the sample programs for the supported compilers using script files supplied with the DB2 SDK for that platform. You can also use the makefiles that are supplied. Both the makefiles and the script files show you the compiler options you can use. These options are defined for each platform's supported compilers in the appropriate chapter. You might need to modify the options for your environment.
When you run a script file to build a sample program containing embedded SQL, the script file executes the following steps:
For User-Defined Functions (UDFs), you do not need to connect to a database or precompile and bind the program.
The following are the sample programs used to demonstrate the steps for building and running your applications using the supported programming languages. The steps you follow may vary, depending on your environment:
For a more detailed description of these sample programs, see Table 3.
The source files for these sample programs, where supported, are in the appropriate programming language subdirectory of sqllib/samples:
After you build the sample programs, they can be used as templates to create your own applications. This can be done by modifying the sample programs with your own SQL statements. You can build your programs using either the makefile or the script files provided.
"Sample Programs" lists all of the sample programs. The Embedded SQL Programming Guide explains how the samples containing embedded SQL work.
| Note: | It is recommended that, before you alter or build the sample programs, you copy them from sqllib/samples to your own working directory. |