IBM Books

Release Notes


4.0 Application Building Guide


4.1 Introduction

The following should be added to the section "About the DB2 Software Developer's Kit":

The DB2 SDK provides developers with two Visual Studio Version 6.0 development extensions. These extensions plug into the Visual C++ IDE to enable the launching of various DB2 GUI tools, and facilitate the development of embedded SQL applications and embedded SQL stored procedures using Microsoft Visual Studio Version 6.0. These two extensions are available from:

   www.software.ibm.com\data\db2\udb\ide

The following should be added to the section "Sample Programs":
Note:The CLI programs sendda and showda are not supported on AIX, Linux, or Windows 32-bit operating systems. The CLI program, async, is not supported on OS/2.

The CLI program duowcon is not supported on HP-UX Version 10 and Silicon Graphics IRIX, and the CLI program multicon only works if two or more different databases are specified; it does not work for multiple connections to the same database.


4.2 Setup

In the section, "Setting the Windows 32-bit Operating Systems Environment", the INCLUDE path is given as %DB2PATH\INCLUDE instead of %DB2PATH%\INCLUDE. The sentence containing this typo is correctly rendered as follows:

When building C or C++ programs, you must ensure that the INCLUDE environment variable contains %DB2PATH%\INCLUDE as the first directory.


4.3 Building Java Applets and Applications

The JDBC sample program, UseThrds, will only run on a server, and not on a client. The Java makefile supplied with the sample programs incorrectly includes this program with the make command for running JDBC samples on the client: make otherclijdbc on UNIX platforms, and nmake oth_clijdbc on OS/2 and Windows 32-bit operating systems.

In the section, "SQLJ Programs", the build files bldsqlj and bldsqljs, as documented, provide the optional parameters database name, user ID, and password for the db2profc command, but do not provide them for the SQLJ command. These optional parameters have been added for the SQLJ command in the build files. These files are in the %DB2PATH%\samples\java directory on OS/2 and Windows 32-bit operating systems, and in the sqllib/samples/java directory on UNIX platforms.

In the section, "General Points for DB2 Applets", the following point should be included:

On Windows platforms, the JDBC applet server, the db2jd listener, can be started automatically or manually as a service. However, if the db2jd listener is started as a service and the port number is different from the default number, 6789, the port number has to be entered manually each time the service is started or the system reboots. This is not very convenient when you want it to start automatically. DB2 now provides a new db2set environment variable, DBJD_PORT_NUMBER. By setting this variable to a port number of your choice, every time db2jd is started without a port number passed in from the command line, this port number will be used. If a port number is passed in directly, that port will be used. If DB2JD_PORT_NUMBER is not set and no port number is passed in, the default port number, 6789, will be used. Refer to the Command Reference for information on how to use the db2set command. The valid value for this entry is any port number (an integer) that is greater than 1024, and is not currently in use.

To build and run JDBC and SQLJ programs on Silicon Graphics IRIX, you must compile and run the programs as o32 objects. To compile and run Java programs as o32 objects, perform the following steps:

  1. Include the sqllib/lib and sqllib/lib32 libraries in your LD_LIBRARY_PATH environment variable. For example, you can add the following lines to a Korn shell script:
       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/sqllib/lib
       export LD_LIBRARYN32_PATH=$LD_LIBRARY_PATH:$HOME/sqllib/lib32
    

  2. To compile and run a JDBC program as an o32 object, you must include the -o32 flag in your build commands. For example, to compile and run the JDBC sample program Dynamic.java, use the following commands:
       javac -o32 Dynamic.java
       java -o32 Dynamic userid password
    

  3. To compile and run an SQLJ program as an o32 object, you must include the -o32 flag in your build commands. For example, to compile and run the SQLJ sample program App.sqlj, use the following commands:
       sqlj -J-o32 App.sqlj
       embprep App sample userid passwd
       java -o32 App userid passwd
    

    Note:In the previous sqlj command, do not include a space between -J and -o32.

The Java makefile, and the bldsqlj build script, located in the sqllib/samples/java directory, need to be modified with the above options before they can be used on Silicon Graphics IRIX.


4.4 Building AIX Applications

4.4.1 Micro Focus COBOL

In the section "Embedded SQL Stored Procedures", the sub-section "Exiting the Stored Procedure" is no longer needed, and can be disregarded. Stored procedures no longer need to exit with the statement:

   move SQLZ-HOLD-PROC to return-code

The two Micro Focus COBOL stored procedure samples supplied by DB2, outsrv and inpsrv, have been changed to reflect this. Instead of using the above statement, they use the following:

   move SQLZ-DISCONNECT-PROC to return-code

4.4.2 REXX

DB2 Universal Database Version 6.1 supports Object REXX for AIX Version 1.1.


4.5 Building HP-UX Applications

In "Micro Focus COBOL", in the section "Embedded SQL Stored Procedures", the following should be added:
Note:At the time of this writing, Micro Focus COBOL Stored procedures are not supported on DB2 for HP-UX Version 11.0. For the latest DB2 for HP-UX application development information, please check the Web site at:

   http://www.software.ibm.com/data/db2/udb/ad

In "Micro Focus COBOL", in the section "Embedded SQL Stored Procedures", the sub-section "Exiting the Stored Procedure" is no longer needed, and can be disregarded. Stored procedures no longer need to exit with the statement:

   move SQLZ-HOLD-PROC to return-code

The two Micro Focus COBOL stored procedure samples supplied by DB2, outsrv and inpsrv, have been changed to reflect this. Instead of using the above statement, they use the following:

   move SQLZ-DISCONNECT-PROC to return-code

4.6 Building OS/2 Applications

In the section, "IBM VisualAge C++ for OS/2 Version 3", sub-section, "DB2 CLI Stored Procedures", the command file, bldclisp, as documented, does not have the object file, samputil.obj, in the link step. The correct link step is in the bldclisp command file in the %DB2PATH%\samples\cli directory, as follows:

   ilink /NOFREE /MAP /NOI /DEBUG /ST:64000 %1.obj samputil.obj,%1.dll,,db2cli.lib,%1.def;

4.7 Building Silicon Graphics IRIX Applications

4.7.1 MIPSpro C

In the section, "Multi-threaded Applications", the script file bldccmt, as documented, should include the link option, -lpthread. The script file has this option in the sqllib/samples/c directory. Here are the correct link steps in bldccmt:

   # Link the program.
   cc -o $1 $1.o util.o -L$DB2PATH/lib -rpath $DB2PATH/lib -lm -ldb2_th -lpthread
   # Link the program for n32 object type support.
   # cc -n32 -o $1 $1.o util.o -L$DB2PATH/lib32 -rpath $DB2PATH/lib32 -lm -ldb2_th -lpthread

4.7.2 MIPSpro C++

In the section, "Multi-threaded Applications", the script file bldCCmt, as documented, should include the link option, -lpthread. The script file has this option in the sqllib/samples/cpp directory. Here are the correct link steps in bldCCmt:

# Link the program.
CC -o $1 $1.o util.o -L$DB2PATH/lib -rpath $DB2PATH/lib -lm -ldb2_th -lpthread
# Link the program for n32 object type support.
# CC -n32 -o $1 $1.o util.o -L$DB2PATH/lib32 -rpath $DB2PATH/lib32 -lm -ldb2_th -lpthread

4.8 Building Applications for Windows 32-bit Operating Systems

In the section, "IBM VisualAge COBOL", sub-section, "Embedded SQL Stored Procedures", the batch file bldvacbs is documented as having "lib" in the first line of the link step. This should be ilib. The link step in the batch file in %DB2PATH%\samples\cobol has the correct link step as follows:

   rem  Link the stored procedure and create a shared library.
   ilib /nol /gi:%1 %1.obj
   ilink /free /nol /dll db2api.lib %1.exp %1.obj iwzrwin3.obj

4.9 Building OS/2 Programs - Java - Building SQLJ Programs

To build and run SQLJ programs with the OS/2 Java Development Kit (JDK), you must turn off the just-in-time compiler of the JDK with the following command:

   SET JAVA_COMPILER=NONE

SQLJ source files may include an end-of-file character (EOF) that causes the SQLJ translator "sqlj" to fail on OS/2 with an exception similar to the following:

   Cursor.sqlj:122.2: Error: Java Parsing. Encountered: \u001a
   Expected: <EOF> ; "abstract" ...; "public" ...; "interface" ...; 
   "#sql" ...; ";" ...;
   Total 1 error.

To remove the offending EOF, open the SQLJ source file in a text editor that does not automatically append an EOF, modify the file by adding a blank line to the end of the file, and resave the file.


[ Top of Page | Previous Page | Next Page | Table of Contents ]

[ DB2 List of Books | Search the DB2 Books ]