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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.156.251