Section 7.12. Packages


7.12. 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, let's review Figure 7.26, which illustrates the preparation of a C application program with embedded SQL.

Figure 7.26. How a package is obtained


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.



Understanding DB2(R. Learning Visually with Examples)
Understanding DB2: Learning Visually with Examples (2nd Edition)
ISBN: 0131580183
EAN: 2147483647
Year: 2004
Pages: 313

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net