We have many legacy csh scripts that connect to our db2 database using "db2 connect to <table>" command. They do NOT use "db2 connect to <table> user <user> using <password>" explicitly, so the connection defaults to the user running the script.
We want to change the db2 connection from the user account running the csh script to a dedicated db2 account (called "dblegacy").
I tried writing a wrapper executable that would load/run as root, and then change account to "dblegacy" before executing the csh scripts. Only problem is Linux (ld.so) removes LD_LIBRARY_PATH environment variable from all scripts/files loaded after setuid() account change to "dblegacy" occurs. And, of course, the csh scripts require shared libraries.
So, I need a way of having "db2 connect to table" use or default to this "dblegacy" account.