db2chglibpath - Modify the embedded runtime library search path command

Modifies the embedded runtime library search path value within an executable or shared library file. It can be used to replace the embedded runtime library search path value with a new user-specified value when the existing value is no longer valid.

The db2chglibpath command can be used to replace the requirement for using operating system library search path environment variables such as LIBPATH (AIX®) and LD_LIBRARY_PATH (AIX, SUN, HPPA64 and Linux®). This command is only supported on Linux and UNIX operating systems. It can be found under the DB2DIR/bin directory, where DB2DIR is the Db2® database installation location.

Prerequisites

  • Read and write access is required on the shared library or executable file to be modified.
  • The binary has to have an embedded library path to start with, and the embedded path cannot be changed to anything bigger than the path already in the binary.
  • The length of the user-specified value that is to replace the embedded runtime library search path value must not be greater than the existing value.
  • This command directly modifies the binary code of the shared library or executable file and it is strongly recommended that you create a backup of the file before using the command.

Required Connection

None

Command syntax

Read syntax diagramSkip visual syntax diagramdb2chglibpath --querypath -q --search= search-expression --replace= replace-expression --show --32 --64 --verbose -v --help -h --mask=n -mn --ignore=n -in -skipInternalPatterns

Command parameters

--querypath
Specifies that a query should be performed without altering the embedded library path in the binary.
--search | -s=search-expression
Specifies the expression to be searched for.
--replace | -r=replace-expression
Specifies the expression that the search-expression is to be replaced with.
--show
Specifies that the search and replace operations are to be performed without actually writing the changes to the files.
--32
Performs the operation if the binary type is 32-bit.
--64
Performs the operation if the binary type is 64-bit.
--verbose
Displays information about the operations that are being performed.
--help
Displays usage information.
--mask | -m
Suppresses error messages for exit values and can only be specified once. Exit values for the mask options are shown under the ignore option.
--ignore | -i
Suppresses a specific error message.
Exit values for mask and ignore options are:
  • 0 - path successfully changed
  • 1 - not all specified search and replace on the operations succeeded.
  • 2 - file was of the right type but does not have a libpath
  • 3 - file was not of the right type to have a libpath
  • >3 - other errors
--skipInternalPatterns
The pattern search and replace methods is performed internally to reclaim potential space on the resultant path. Use this option to avoid this replacement.

Examples

  • To change the embedded runtime library search path value in the executable file named myexecutable from /usr/opt/db2_08_01/lib to /u/usr1/sqllib/lib32, issue:
    db2chglibpath --search=/usr/opt/db2_08_01/lib --replace=/u/usr1/sqllib/lib32
       /mypath/myexecutable
    Note that the length of the new value is the same as that of the original value.

Usage notes

  • This command is only to be used for updating Db2 database application executables and Db2 external routine shared library files when other methods for upgrading applications and routines cannot be used or are unsuccessful. See the related links for topics on application and routine upgrade.
  • This command is not supported under Db2 service contract agreements. It is provided as-is and as such, IBM is not responsible for its unintended or malicious use.
  • This command does not create a backup of the shared library or executable file before modifying it. It is strongly recommended that a backup copy of the file be made before issuing this command.