On Thu, Sep 29, 2005 at 07:49:52PM -0700, Shah wrote:
> Setting: Perl 5.8.2 on Solaris 9
> 
> We need to set these 2 environment variables from Perl:
> 
> $ENV{DB2INSTANCE} = 'db2inst3';
> $ENV{LD_LIBRARY_PATH} = '/export/home/db2inst3/sqllib/lib';
> 
> We even tried enclosing them in a BEGIN block, but we're getting:

LD_LIBRARY_PATH needs to be set before the process starts.

Tim.

> install_driver(DB2) failed: Can't load 
> '/usr/iw-home/iw-perl/site/lib/auto/DBD/DB2/DB2.so' for module DBD:DB2: 
> ld.so.1: /usr/iw-home/iw-perl/bin/perl: fatal: libdb2.so.1: open failed: No 
> such file or directory at /usr/iw-home/iw-perl/lib/DynaLoader.pm line 229.
> at (eval 6) line 3
> Compilation failed in require at (eval 6) line 3.
> Perhaps a required shared library or dll isn't installed where expected
> at /usr/iw-home/custom/lib/dbAccess.pm line 62
> 
> In dbAccess.pm. just before issuing DBI->connect, we've added some logging 
> information, which shows:
> 
> key: |LD_LIBRARY_PATH| value: |/export/home/db2inst3/sqllib/lib|
> key: |DB2INSTANCE| value: |db2inst3|
> 
> Issuing LD_LIBRARY_PATH=/export/home/db2inst3/sqllib/lib from the command 
> line results in the same error (at least some of the time), but the log 
> shows that LD_LIBRARY_PATH is correctly set.
> 
> However, issuing export LD_LIBRARY_PATH=/export/home/db2inst3/sqllib/lib 
> from the command line and running our test script works every time. So how 
> do we export those environment variables from Perl?
> 
> Incidentally, last week the following was causing trouble:
> 
> $ENV{'DB2INSTANCE'} = 'db2inst3';
> $ENV{'LD_LIBRARY_PATH'} = '/export/home/db2inst3/sqllib/lib';
> 
> Note the single-quotes on the left side. Removing them worked (last week). 
> But not today. Double-quotes or no quotes ain't making a difference.
> 
> Looks like things stopped working without any changes to the Perl code. The 
> PATH changed, I think, but setting it to nothing didn't help. Incidentally, 
> which binary should be referring to LD_LIBRARY_PATH and loading libdb2.so.1? 
> Although, why would simply exporting LD_LIBRARY_PATH from the command line 
> make our test script work?
> 
> Any ideas?
> 
> Thanks,
> 
> S. 
> 
> 

Reply via email to