Building CLI multi-connection applications on Windows
Db2®
provides batch files for compiling and linking CLI programs. These are
located in the sqllib\samples\cli
directory, along with sample programs that can be
built with these files.
About this task
The batch file, bldmc.bat
, contains the commands to build a Db2 multi-connection
program requiring two databases. The compile and link options are the same as those used in
bldapp.bat
.
%1
, specifies the name of your source
file. The second parameter, %2
, specifies the name
of the first database to which you want to connect. The third parameter, %3
, specifies the second database to which you want to connect.
These are all required parameters. %2
and %3
) so if you are using the makefile, and accept
these defaults, you only have to specify the program name (the %1
parameter). If you are using the bldmc.bat
file, you must specify all three parameters.Optional
parameters are not required for a local connection, but are required
for connecting to a server from a remote client. These are: %4
and %5
to specify the user ID and password
for the first database; and %6
and %7
to specify the user ID and password for the second database.
For the multi-connection sample program, dbmconx
, you require two databases. If the sample
database
is not yet created, you can create it by entering db2sampl
on the command line. The second database, here called sample2
, can be created with one of the following commands: