Ah, one other _very_ likely possibility is that the user running the tests (or any other script using DBD::DB2) had not inherited the DB2 instance profile before running the tests.

The DB2 instance profile sets the environment variables that enable the DB2 client to find things like libdb2.so, catalog entries for DB2 databases & servers, etc. It's an important step, but it often happens automatically because the user ID used to run the DB2 application just happens to be a DB2 instance owner.

For example, if you create a DB2 instance using user 'db2inst1' in /home/db2inst1, and you log in as 'db2inst1' and run the Perl script, you'll already have the DB2 instance environment set up.

But if you log in as user 'daniel' on the same system and try to run the Perl script, the script will fail (usually with a helpful error like "Total environment allocation error"). The proper fix for this is to inherit the DB2 instance environment before running the Perl script that relies on DBD::DB2 by sourcing the db2profile script that sets all of the environment variables for the DB2 instance user, e.g.

[EMAIL PROTECTED]:\ > . /home/db2inst1/sqllib/db2profile
[EMAIL PROTECTED]:\ > perl update_database.pl

I would recommend deleting /usr/lib/libdb2.so.1 and trying this approach instead, as any other libraries that DB2 depends on will not be found using your approach.

Dan

Alec Brecher wrote:
Thank you Dan. The make ran without complaint, but the make test failed 4 of 5 tests. The first time I went ahead and installed anyway and ran a test script which completely failed. The error was that libdb2.so.1 could not be found.

Based on your theory below I copied libdb2.so.1 to /usr/lib and everything is running! Not pretty but it works. Thanks so much. -Alec

Dan Scott wrote:

Alec Brecher wrote:

My DBD-DB2 installation on Fedora Core 3 is failing because it cannot find libdb2.so.1.

The Application Dev client is installed and works fine. The DB2_HOME=/home/db2inst1/sqllib

I saw some post from Owen Berry on another list regarding this issue. His fix: add -Wl,-rpath,/home/db2inst1/sqllib/lib to the makefile did not work for me.

DBI = 1.48
DBD-DB2 = 0.78
perl = 5.8.5

Any help would be greatly appreciated.

-Alec


Hi:

Is the problem occurring at install time, or at run time (specifically within the context of a Web application)?

If the problem is occurring at install time, please post the exact set of commands you are issuing, along with the results of running 'set', and all of the output you get from trying to compile and install DBD::DB2.

If the problem is occurring within the context of a Web application where Apache seems to be dying, you need to disable SELinux (/usr/sbin/setenforce 0) as the default policies for SELinux in Fedora Core 3 / RHEL 4 prevent httpd (Apache) from loading libraries like libdb2.so that exist in non-standard locations. As libdb2.so resides in /opt/IBM/db2/V8.1/lib/ rather than /usr/lib/ , the SELinux policy believes that someone is trying to load an evil harmful library and kills the process. I wish I knew enough about SELinux policies to offer a modification that would enable libdb2.so to be loaded, but I just don't seem to have enough room in my brain...

Dan


Reply via email to