IBM Support

db2 command is not working

Question & Answer


Question

Why does not db2 command execute any statement?

Cause

The cause of this can be:
1- The PATH environment variable is not set up correctly
2- There is another db2 executable file in your environment

Answer

1- Check the PATH environment variable and make sure the "<instance_home>/sqllib/bin" directory is set up as follows:

 - echo $PATH

This is an example of the output:

echo $PATH
 /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/sqllib/db2tss/bin:/home/db2inst1/bin
 


2- Check which db2 executable is being executed on the system by running the command below:

 - which db2

the expected output should be "<instance_home>/sqllib/bin/db2"

Here are examples of the output:

  which db2
  /home/db2inst1/db2  (this shows a wrong db2 executable file)


  which db2
 /home/db2inst1/sqllib/bin/db2  (this shows an expected output)







[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"DB2 Tools - Troubleshooting","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.1;10.5;9.5;9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21683516