Saturday 17 August 2013

DB2 Packages

A package is a database object consisting of executable SQL, including the access path the DB2 optimizer will take to perform the SQL operation.
To explain how a package works, which illustrates the preparation of a C application program with embedded SQL.

In the figure, the C program myprg.sqc contains embedded SQL.
Issuing the precompile command (also known as the prep command) with the bindfile option generates two files, the myprg.bnd bind file containing only SQL information and the myprg.c file containing only C code.
The bind file will be compiled using the bind command to obtain a package that is stored in the database. To issue the bind command, a connection to the database must exist.
The myprg.c file will be compiled and linked like any regular C program. The resulting executable file myprg.exe has to be in sync with the package stored in the database to successfully execute.


Created with Artisteer

No comments:

Post a Comment

New In-feed ads