Need urgent help....

Need urgent help....

am 08.12.2006 10:25:41 von sanjay_2006

Hello Techies,
I am using perl for a simple program which acess oracle db (on other
machine) using DBI. It works fine using my login id.
When I try to execute same script using crontab it fails, it gives
error:

install_driver(Oracle) failed: Can't locate loadable object for module
DBD::Oracle in @INC (@INC contains:
/usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5
............

Why doesnt it fail if i run the program using my login? why it fails
when i run it through cron?

I am using Linux..

Please help.

Thanks,
Sanjay


--
sanjay_2006
------------------------------------------------------------ ------------
sanjay_2006's Profile: http://techiegroups.com/member.php?userid=1133
View this thread: http://www.techiegroups.com/showthread.php?t=122471

Re: Need urgent help....

am 08.12.2006 16:05:40 von paduille.4060.mumia.w

On 12/08/2006 03:25 AM, sanjay_2006 wrote:
> Hello Techies,
> I am using perl for a simple program which acess oracle db (on other
> machine) using DBI. It works fine using my login id.
> When I try to execute same script using crontab it fails, it gives
> error:
>
> install_driver(Oracle) failed: Can't locate loadable object for module
> DBD::Oracle in @INC (@INC contains:
> /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5
> .............
>
> Why doesnt it fail if i run the program using my login? why it fails
> when i run it through cron?
>
> I am using Linux..
>
> Please help.
>
> Thanks,
> Sanjay
>
>

You don't say what Linux distribution you're using.

Perhaps you've set up PERL5LIB for your login, but it's not set up
properly for cron jobs. Or perhaps different file access permissions
apply for cron jobs than for processes running under logins.

Use this program to print the @INC array and run it under both the login
and the cron job:

$" = "\n";
print "@INC\n"

The two should be the same, and the directory containing the DBD::Oracle
driver should be in both listings.

In your login, find out where DBD::Oracle is located by running a
program like this:

use DBD::Oracle;
$, = "\n";
print grep /DBD/, values %INC, "\n";

Then try to make sure that the file is accessible within a cron job by
listing the directory or doing a "head" on the file itself:

#!/bin/sh
head /usr/share/perl5/DBD/CSV.pm

(I don't have DBD::Oracle installed.)

If you use Redhat or Fedora Core, or CentOS, you probably have selinux
which can restrict access to files in certain contexts, so investigate
configuring selinux to allow cron jobs to have access to the DBD::Oracle
file.

When you create a subject line for a message, you should provide a
subject line that that helps describe the problem, e.g. "need help using
DBD::Oracle within cron job."


--
paduille.4060.mumia.w@earthlink.net

Re: Need urgent help....

am 08.12.2006 16:09:17 von Paul Lalli

sanjay_2006 wrote:
> Subject: Need urgent help....

This kind of rudeness is likely to get you *less* help, not more. Your
or your company's failure to plan or assign appropriate resources to a
task makes something "urgent" for you, not for us. No one here is
obligated to respond to you at all, let alone in any particular time
frame.


> I am using perl for a simple program which acess oracle db (on other
> machine) using DBI. It works fine using my login id.
> When I try to execute same script using crontab it fails, it gives
> error:
>
> install_driver(Oracle) failed: Can't locate loadable object for module
> DBD::Oracle in @INC (@INC contains:
> /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5

My guess is that you didn't install DBD::Oracle properly. You probably
installed it in your local directory, or you just copied a bunch of
files to your local directory rather than actually installing it.

Run the following code, logged in as you:
perl -MDBD::Oracle -le'print $INC{q{DBD/Oracle.pm}}'

Whatever directory that returns is the directory you need to add to the
script's @INC in order to get the module to be found.

> Why doesnt it fail if i run the program using my login? why it fails
> when i run it through cron?

cron() does not call any of your environment settings, such as
..profile. So whatever settings you have when you're logged in are not
seen by the script when running through Perl.

Paul Lalli

Re: Need urgent help....

am 11.12.2006 05:14:01 von sanjay_2006

Thanks Mumia and Paul.

Will try it out.


--
sanjay_2006
------------------------------------------------------------ ------------
sanjay_2006's Profile: http://techiegroups.com/member.php?userid=1133
View this thread: http://www.techiegroups.com/showthread.php?t=122471