Let me see if I understand your question correctly. You have C or C++ external UDFs that depend on some other libraries. If so, I think you should set the DB2 registry variables, not your environment variables:
export LD_LIBRARY_PATH=/usr/local/lib:$LIBPATH # this must be in the global profile
db2set DB2LIBPATH=$LD_LIBRARY_PATH
db2set DB2ENVLIST="LD_LIBRARY_PATH otherstuff"
The LD_LIBRARY_PATH variable must be set in the environment for the instance owner user and the DB2 fenced user, because the external routines run under one of these two. Probably the best way to do it is to set /etc/profile. This should be done before executing the db2set
commands.
After setting the registry variables using db2set
you must restart the DB2 instance (db2stop force
then db2start
).