Setting up the application development environment (Windows)

To set up an application development environment on Windows operating systems , you must follow these steps.

About this task

When you install the IBM® Data Server Client on Windows operating systems, the install program updates the configuration registry with the environment variables INCLUDE, LIB, and PATH. The system-wide environment variable, DB2INSTANCE, is set by install to the default instance created, called Db2®. DB2PATH is set inside a Db2 command window when the window is opened.

You can override these environment variables to set the values for the system or the currently logged-on user. Exercise caution when changing these environment variables. Do not change the DB2PATH environment variable. DB2INSTANCE is defined as a system-level environment variable. If DB2INSTANCE is not set, you do not have to make use of the DB2INSTDEF Db2 registry variable which defines the default instance name to use.

Procedure

  1. To override the environment variable settings, use the Windows Control Panel.
    When using the variable %DB2PATH% in a command, put the full path in quotation marks, as in:
    set LIB="%DB2PATH%;%LIB%"

    The default installation value for this variable is \Program Files\IBM\SQLLIB, which contains a space, so put the full path in quotation marks.

  2. In addition, you must take the following specific steps for running Db2 applications:
    • When building C or C++ programs, you must ensure that the INCLUDE environment variable contains %DB2PATH%\INCLUDE as the first directory.
      To do this, update the environment for your compiler:
      1. Launch the shortcut to the Visual Studio Command Prompt.
      2. In the Visual Studio Command window, run DB2CMD.exe to open the Db2 Command Window.
      3. In the Db2 Command Window, set your INCLUDE path as follows :
        set INCLUDE=%DB2PATH%\INCLUDE;%INCLUDE%
    • When building Micro Focus COBOL programs, set the COBCPY environment variable to point to %DB2PATH%\INCLUDE\cobol_mf.
    • When building IBM COBOL programs, set the SYSLIB environment variable to point to %DB2PATH%\INCLUDE\cobol_a.
    • Ensure the LIB environment variable points to %DB2PATH%\lib by using:
      set LIB="%DB2PATH%\lib";%LIB%
    • To run an application against a remote server, both the client and the server must be properly configured. For instance, the DB2COMM environment variable must be set at the server of the remote database.