Search code examples
databasedb2db2-express-c

db2exfmt unable to open output file


I am trying to create query explain tables using db2exfmt. I am using db2 CLP and I am following below steps:

  1. Connect to sample
  2. set current explain mode explain
  3. My query = select * from staff where JOB = 'Sales'
  4. db2 set current explain mode no
  5. db2exfmt -d sample -# 0 -w -1 -g -TIC -n % -s % -o output.txt

After the last step, I am getting this output:

Connecting to the Database.
Connect to Database Successful.
Unable to open output file.

I am not sure why it is not able to open output file. How should I resolve this issue?

CMD OUTPUT


Solution

  • It appears that you don't have write access to the C:\Program Files\IBM\SQLLIB\BIN directory, so db2exfmt can't open the output file for writing.

    Change to a directory you do have write permissions, or specify a file name with path for the -o option.