Question

I would like to use a shared library I produced from db2 queries.

My shared library depends on boost that, in my machine, is locate in /usr/local/lib.

When I try to run the queries using my functions I got errors: they dosn't work because db2 cannot find boost libraries i.e. cannot resolve the location of the libraries.

How to tell db2 where to locate the libraries path and which enviromnent variable s I should use?

I tried to ise userprofile and profile.env but without success.

 # userprofile
 LIBPATH=/usr/local/lib:LIBPATH

 #profile.env
 DB2ENVLIST='LIBPATH ..other stuf'
Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top