Application Building Guide

Embedded SQL Applications

Note:Embedded SQL for Java (SQLJ) is not discussed here, but is fully discussed in "Building Java Applets and Applications".

The DB2 AD Client includes sample programs that embed SQL statements. The "Building Applications" chapters later in the book explain how to build the sample programs for the supported compilers using build files supplied with the DB2 AD Client for that platform. You can also use the makefiles that are supplied. Both the makefiles and the build 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 build file to build a sample program containing embedded SQL, the build file executes the following steps:

The following are the sample programs used in this book to demonstrate the steps for building and running embedded SQL applications using the supported programming languages. The steps you follow may vary, depending on your environment:

updat
uses static SQL to update a database.

The following samples are used to demonstrate embedded SQL client applications for stored procedures and user-defined functions (UDFs) using C and C++:

spclient
is the client program that demonstrates calling stored procedures; the server program is spserver.

spserver
is the server program demonstrating stored procedures; the client program is spclient.

udfcli
uses the ScalarUDF function in the user-defined function library, udfsrv.

The following samples are used to demonstrate stored procedures and user-defined functions (UDFs) using COBOL:

outcli
is the client program that demonstrates calling stored procedures; the server program is outsrv.

outsrv
is the server program demonstrating stored procedures; the client program is outcli.

calludf
calls the functions in the user-defined function library, udf.

Links to the source code of these programs are available for the following languages:

C
updat.sqc , outcli.sqc , outsrv.sqc , calludf.sqc

C++
updat.sqC , outcli.sqC , outsrv.sqC , calludf.sqC

COBOL
updat.sqb , outcli.sqb , outsrv.sqb

For a more detailed description of these sample programs, see Sample Program Tables.

The source files for these sample programs, where supported, are in the appropriate programming language subdirectory of sqllib/samples on UNIX, and %DB2PATH%\samples on OS/2 and Windows 32-bit operating systems.

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 build files provided.

"Sample Programs" lists all of the sample programs. The Application Development Guide explains how the samples containing embedded SQL work.

The following list points you to where you can find building information for the DB2 embedded SQL applications and stored procedures for supported platforms and compilers:

AIX IBM C
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures".

AIX IBM C Set++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures".

AIX IBM VisualAge C++
"Embedded SQL Applications" and "Embedded SQL Stored Procedures".

AIX IBM COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures".

AIX Micro Focus COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures".

HP-UX C
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

HP-UX C++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

HP-UX Micro Focus COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

GNU/Linux gcc (C)
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

GNU/Linux gcc (C++)
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

OS/2 IBM VisualAge Version 3 for C++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

OS/2 IBM VisualAge Version 4 for C++
"Embedded SQL Applications" and "Embedded SQL Stored Procedures".

OS/2 IBM VisualAge for COBOL
"Embedded SQL Applications" and "Embedded SQL Stored Procedures"

OS/2 Micro Focus COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Silicon Graphics IRIX MIPSpro C
"DB2 API and Embedded SQL Applications"

Silicon Graphics IRIX MIPSpro C++
"DB2 API and Embedded SQL Applications"

Solaris SPARCompiler C and IBM C
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Solaris SPARCompiler C++ and IBM C Set++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Solaris Micro Focus COBOL
"DB2 API and Embedded SQL Applications"

Windows 32-bit Operating Systems Microsoft Visual C++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Windows 32-bit Operating Systems IBM VisualAge Version 3.5 for C++
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Windows 32-bit Operating Systems IBM VisualAge Version 4.0 for C++
"Embedded SQL Applications" and "Embedded SQL Stored Procedures".

Windows 32-bit Operating Systems Micro Focus COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"

Windows 32-bit Operating Systems IBM VisualAge for COBOL
"DB2 API and Embedded SQL Applications" and "Embedded SQL Stored Procedures"


[ Top of Page | Previous Page | Next Page ]