Permanently set DB2CLP environment variable

I have a problem with DB2CLP environment variable, on Windows 7 64, IBM_client64_V97 (to be connected with DB2).

Every time when i try to DB2 in Windows command prompt window, I receive this error:

DB21061E Command line environment not initialized.

and per this document using just this step:

2. at the prompt enter these commands:
db2cmd -i -w db2clpsetcp
echo %DB2CLP%
I fix that error, and "db2" command opens Command Line Processor for DB2 Client. But it lasts only until windows CMD is open. As soon as I close it and reopen, I have to repeat process.

My question (being absolute novice to DB2) is:

How should I make that change permanent and
How this happened at the first place as I installed and setup everything according to the manual (including adding local user to DB2USERS and DB2ADMINS) groups?
Who is Participating?
Kent OlsenData Warehouse Architect / DBACommented:
That's because the normal DOS (or Windows) prompt doesn't automatically run the setup script that enables the DB2 commands.  When the setup runs, it puts the DB2 items first in the PATH variable.  That could conflict with other tools that also want to be first on the search list.

If you've got both the DOS (Windows) and DB2 command line prompts on your desktop, right click them and select Properties.  You'll notice that the system (DOS) prompt runs cmd.exe.  

The DB2 prompt runs DB2CMD.exe from the DB2 libraries.  The DB2 script then runs DB2SETCP.BAT and finally DB2.EXE.  (All of the DB2 executables should be in C:\Program Files\IBM\SQLLIB\BIN.)

So there are differences in the two prompts.  For you purposes, try running DB2SETCP.BAT from the normal DOS prompt.  That may be sufficient for your needs.

For my purposes I always have the DOS and DB2 prompts on my desktop and just select the one that I need.

Kent OlsenData Warehouse Architect / DBACommented:
Hi Nenad,

When you installed the DB2 client, it should have installed a functional window to the command line processor.  Check here:

  Start / All Programs / IBM DB2 / DB2copy1/ Command Line Processor

Note that DB2copy1 is the default location for the first db2 instance.  The name may be different if you selected the non-default name.

You can copy/paste a shortcut to the CLP on your desktop.

Good Luck!
KPaxAuthor Commented:
Yes I have that (it's installed, and it's working OK) but I thought that should be able to type in windows CDM something like "DB2 ..some command..." but  I got the error I described,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.