Building CLI routines on UNIX
Db2 provides
build scripts for compiling and linking Db2 Call Level Interface (CLI)
programs.
These are located in the sqllib/samples/cli directory,
along with sample programs that can be built with these files. The
script file
bldrtn contains the commands to build CLI routines
(stored procedures and user-defined functions). bldrtn creates
a shared library on the server. It takes a parameter for the source
file name, represented inside the script file by the variable $1.Procedure
To build the sample program spserver from
the source file spserver.c:
Results
spserver,
you can build the CLI client
application, spclient, that calls the routines within
the shared library. The client application can be built like any
other CLI client
application by using the script file, bldapp.
To access the shared library, run the sample client application by entering:
spclient database userid password
where
- database
- Is the name of the database to which you want to connect.
The name could be
sample, or its alias, or another database name. - userid
- Is a valid user ID.
- password
- Is a valid password.
The client application accesses the shared library, spserver,
and executes the routines on the server database. The output is returned
to the client application.