Upgrading CLI applications

Upgrading your existing CLI applications to Db2® version 11.5 involves managing the changes between Db2 version 11.5 and previous releases that impact these applications, such as operating system support changes, development software support changes, the bit-width of the application, and the bit-width of the Db2 instance on which you deploy the applications.

Before you begin

  • Ensure that you have access to a Db2 version 11.5 server, including instances and databases. The Db2 server can be part of a testing environment.
  • Ensure that the C and C++ development software is a version that is supported by Db2 database products.
  • Perform previous steps in the Upgrading database applications task.


Restrictions

This procedure only applies to database applications programmed in C or C++ using the CLI interface.

Procedure

To upgrade your CLI applications to Db2 version 11.5:

  1. If you modified the library path environment variables, ensure that those variables include the correct Db2 shared library path for your applications, as shown in Upgrade essentials for database applications. You can use the environment variables listed in this table to specify additional paths that enable your applications to find the appropriate Db2 shared library at run time (in most cases).

    On Linux® operating systems only: If you link an application using the RPATH link option without also specifying the RUNPATH link option, the LD_LIBRARY_PATH environment variable is ignored at application run time, which can cause your application to fail.

  2. If you have set the CLISchema configuration keyword in your db2cli.ini file, set the SysSchema configuration keyword instead. The CLISchema configuration keyword is discontinued since Db2 Version 9.5.
    SysSchema = alternative schema 
  3. Test your CLI applications in a Db2 version 11.5 testing environment. If testing is successful, you do not need to perform the remaining steps.
  4. If you set the BlockLobs CLI configuration keyword to 1 and your application gets the error message SQL0973N, perform one of the following actions:
    • Set the database_memory configuration parameter to AUTOMATIC. This is the best option.
    • Reset the BlockLobs CLI configuration keyword to 0.
    • Bind LOB values directly to buffers instead of using LOB locators.
    Your client requires more memory to receive LOB data because this cursor blocking setting using the BlockLobs keyword sends all the LOB values immediately to your client after the row data is sent.
  5. Review CLI and ODBC function summary to determine if you are using any of the deprecated functions in ODBC 3.0 and modify your application to use the replacement function instead. Although this version of CLI continues to support these functions, using the replacement functions ensures that your applications conform to the latest standards.
  6. Explicitly specify the correct Db2 shared library path for your applications by performing one of the following actions:
    • If the application source code is available, rebuild the applications. Specify the required Db2 shared library path as shown in Upgrade essentials for database applications. This is the best option.

    • Create a wrapper script to run your applications. In the wrapper script, explicitly set the library path environment variable to the required Db2 shared library path as shown in Upgrade essentials for database applications.

    • If you do not have the original source code available, run the db2chglibpath command to update the embedded runtime library path within the binary code of your applications. This command is provided as-is and should therefore be considered a last resort.

What to do next

After upgrading your CLI applications, perform the remaining steps in the Upgrading database applications task.