The script file clibld contains the commands to build the sample DB2 CLI program clisampl.c. You can find both the script file and clisampl.c in sqllib/samples/cli.
Study the script file's compile and link options for the platform you are using. Then go to "Building and Running a CLI Program" for the steps to follow in order to build and run the program.
IBM XL C is used in the following version of the clibld script file:
#! /bin/ksh # clibld script file -- AIX # Build clisampl # Compile the program. xlc -I/usr/lpp/db2_05_00/include -c clisampl.c # Compile the common utility functions used by most CLI sample programs xlc -I/usr/lpp/db2_05_00/include -c samputil.c # Link the program. xlc -o clisampl clisampl.o samputil.o -L/usr/lpp/db2_05_00/lib -ldb2 |
| Compile and Link Options for clibld |
|---|
|
The script file contains the following compile options:
|
|
The script file contains the following link options:
Refer to your compiler documentation for additional compiler
options.
|
| Note: | Multi-threaded applications on AIX Version 4 need to be compiled and linked with the xlc_r compiler instead of the xlc compiler, or with the xlC_r compiler instead of the xlC compiler. See "Multi-threaded Applications" for more information on building C multi-threaded applications. |
HP-UX C is used in the following version of the clibld script file:
#! /bin/ksh # clibld script file -- HP-UX # Build clisampl # Compile the program. cc -Aa +DAportable +e -I/opt/IBMdb2/V5.0/include -c clisampl.c # Compile the common utility functions used by most CLI sample programs cc -Aa +DAportable +e -I/opt/IBMdb2/V5.0/include -c samputil.c # Link the program. cc +DAportable -o clisampl clisampl.o samputil.o -L/opt/IBMdb2/V5.0/lib -ldb2 -lhppa |
| Compile and Link Options for clibld |
|---|
|
The script file contains the following compile options:
|
|
The script file contains the following link options:
Refer to your compiler documentation for additional compiler
options.
|
| Note: | Multi-threaded applications on HP-UX version 11 need to have _REENTRANT defined for their compilation. The HP-UX documentation recommends compiling with -D_POSIX_C_SOURCE=199506L. This will also ensure _REENTRANT is defined. Applications also need to be linked with -lpthread. Multi-threaded applications are not supported by DB2 on HP-UX version 10. See "Multi-threaded Applications" for more information on building C multi-threaded applications. |
SCO UnixWare 7 Optimizing C Compilation System is used in the following version of the clibld script file:
#! /bin/ksh # clibld script file # Build clisampl # Compile the program. cc -Kthread -I/opt/IBMdb2/V5.0/include -c clisampl.c # Compile the common utility functions used by most CLI sample programs cc -Kthread -I/opt/IBMdb2/V5.0/include -c samputil.c # Link the program. cc -o clisampl clisampl.o samputil.o -Kthread -L/opt/IBMdb2/V5.0/lib -ldb2 |
| Compile and Link Options for clibld |
|---|
|
The script file contains the following compile options:
|
|
The script file contains the following link options:
Refer to your compiler documentation for additional compiler
options.
|
| Note: | SCO UnixWare 7 C multi-threaded applications use Unix International threads APIs, which require that the thread.h and synch.h header files be included in the program compilation. See "Multi-threaded Applications" for more information on building C multi-threaded applications. |
DB2 for Silicon Graphics IRIX is client-only. To run DB2 applications, you need to access a DB2 database on a server machine from your client machine. The server machine will be running a different operating system. See Quick Beginnings for UNIX for information on configuring client-to-server communication.
Also, since you will be accessing a database on the server from a remote client that is running on a different operating system, you need to bind the database utilities, including the DB2 CLI, to the database. See "Binding" for more information.
The MIPSpro C compiler is used in the following version of the clibld script file:
#! /bin/ksh # clibld script file # Build clisampl # Compile the program. cc -I/opt/IBMdb2/V5.0/include -c clisampl.c # Compile the common utility functions used by most CLI sample programs cc -I/opt/IBMdb2/V5.0/include -c samputil.c # Link the program. ld -o clisampl clisampl.o samputil.o -L/opt/IBMdb2/V5.0/lib -rpath /opt/IBMdb2/V5.0/lib -ldb2 |
| Compile and Link Options for clibld |
|---|
|
The script file contains the following compile options:
|
|
The script file contains the following link options:
Refer to your compiler documentation for additional compiler
options.
|
SPARCompiler C is used in the following version of the clibld script file:
#! /bin/ksh # clibld script file -- Solaris # Build clisampl # Compile the program. cc -I/opt/IBMdb2/V5.0/include -c clisampl.c # Compile the common utility functions used by most CLI sample programs cc -I/opt/IBMdb2/V5.0/include -c samputil.c # Link the program. cc -o clisampl clisampl.o samputil.o -L/opt/IBMdb2/V5.0/lib -R/opt/IBMdb2/V5.0/lib -ldb2 |
| Compile and Link Options for clibld |
|---|
|
The script file contains the following compile options:
|
|
The script file contains the following link options:
Refer to your compiler documentation for additional compiler
options.
|
| Note: | Multi-threaded applications using SPARCompiler C on Solaris need to be compiled with -mt. This will pass -D_REENTRANT to the preprocessor, and -lthread to the linker. Posix threads also require -lpthread to be passed to the linker. In addition, using the compiler option -D_POSIX_PTHREAD_SEMANTICS allows posix variants of functions such as getpwnam_r(). See "Multi-threaded Applications" for more information on building C multi-threaded applications. |