When I type this:
su <user> -c "/home/<user>/sqllib/bin/db2 catalog tcpip node <dbName> remote <ip> server <port>"
I get this error message:
SQL10007N Message "-1390" could not be retrieved. Reason code: "3".
But when I do this:
su <user>
/home/<user>/sqllib/bin/db2 catalog tcpip node <dbName> remote <ip> server <port>
It works fine.
The problem is, I can't use "su" without -c because I'm placing this into a Python script, and Python loses the prompt to Bash when it runs "su".
I think my problem lies with my environment variables somehow – how would I determine what the difference is between my environment variables in each case, and more importantly, how can I fix them in the su -c case?
Best Answer
You can find the difference between the environments like this:
You can modify the environment in the second case like this:
Now for the specific problem I was having, I discovered that I needed the variable
DB2INSTANCE
set. So this worked for me: