RE: Running DBI, ODBC in the crontab

RE: Running DBI, ODBC in the crontab

am 12.04.2006 15:16:36 von KongA

------_=_NextPart_001_01C65E33.53A96030
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Have you try to set LD_LIBRARY_PATH and LD_RUN_PATH in your perl script? =
I had the same problem before and it was fixed by setting these =
variables in the perl script. Cron jobs are not having the same =
environmental variables even with the same users.

-----Original Message-----
From: Stephen.Chung@ubs.com [mailto:Stephen.Chung@ubs.com]
Sent: Tuesday, April 11, 2006 5:34 PM
To: dbi-users@perl.org
Cc: Stephen.Chung@ubs.com
Subject: Running DBI, ODBC in the crontab



Hi,=20

I am running a perl script, using DBI and ODBC (from DataDirect), on a =
linux box to connect to SQL server. It works fine if I run it from a =
shell command line.

However, if I put it into a crontab (the same user), I got the following =
error:=20

install_driver(ODBC) failed: Can't load =
'/QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so' for module =
DBD::ODBC: libstdc++.so.5: cannot open shared object file: No such file =
or directory at /sbcimp/run/pd/perl/5.8.3/lib/DynaLoader.pm line 229.

at (eval 1) line 3=20
Compilation failed in require at (eval 1) line 3.=20
Perhaps a required shared library or dll isn't installed where expected=20

The failure is at the line=20

$dbh =3D DBI->connect=20

Here is what I tried to diagnosis.=20

0. if I do "ldd =
/QRT/ODBC/perlModule/myInstall/lib/auto/DBD/ODBC/ODBC.so" from a shell =
command, there is a clear path associated with libstdc++.so.5

1. I checked (by printing out the environment variable's LD_LIBRARY_PATH =
within my perl script) the LD_LIBRARY_PATH, the path for item 0 is =
there.

2. if I repeat the item 0 within the perl script (when running in the =
crontab), the output indicates the library (ODBC.so) is fine with =
correct linkage.

Every debugging output looks normal, and I just could not find the =
problem...=20

It will be greatly appreciated if some expert can share his experience =
with me.=20

Many thanks.=20

Best,=20


Stephen Chung=20




------_=_NextPart_001_01C65E33.53A96030--