When attempting to run any commands in the Windows command line, as in the following example, an error message is displayed: DB21061E Command line environment not initialized
The user is unable to connect to the DB2 database.
The environment variable DB2CLP is not set correctly
Diagnosing The Problem
As an example: attempt to connect to the database:
C:\programdata\IBM\DB2\DB2TSM1\SERVER1>db2 connect to MYDB
This will fail with "DB21061E Command line environment not initialized"
Resolving The Problem
Run the following command to set the DB2 command line (DB2CLP) variable:
db2cmd -i -w db2clpsetcp
Check that the DB2CLP variable has been set correctly:
This should now show:
Once this is done, the db2 connect command should work properly
16 June 2018