IBM Books

Application Development Guide


Building the Stored Procedure

Stored procedure applications have special compile and link requirements. The client procedure must be part of an executable file, while the stored procedure must be placed in a library on the database server.

When testing these applications, it is helpful to execute both procedures locally on the same machine. (This machine must be configured as a client/server.) After the application executes locally without error, move the stored procedure to a database server, or move the client procedure to a database client for further testing.

Client Application

The precompile, compile, and link requirements of the client application are identical to those of a normal database application.

Refer to the Application Building Guide for details on how to build and execute a client application in the programming language you want to use.

Stored Procedure

To build a stored procedure, you must perform the following steps:

  1. Precompile the stored procedure source file, with the exception of JDBC or DB2 CLI stored procedures

  2. Compile and link the stored procedures to produce a library. The compile and link commands usually require special options.

  3. Bind the stored procedure to the database on the server if it contains embedded SQL. You do not have to bind JDBC and DB2 CLI stored procedures.

For all of these steps, the stored procedure must use the same code page as the database.

Refer to the Application Building Guide for detailed instructions on building your stored procedures.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]