2

I executed the below perl script,

#!/usr/bin/perl

use strict;
use DBD::Oracle;
use DBI;

my $driver = "Oracle";
my $database = "host=xxxxxx;port=6210;sid=xxxx";
my $dsn = "DBI:$driver:$database";
my $userid = "xxxxx";
my $password = "xxxxx";

#Database Connection
my $dbh = DBI->connect($dsn, $userid, $password,{RaiseError => 1}) or die "$DB::errstr";
my $sth = $dbh->prepare("update collabuser set user_email='aravikum.wipro.com' where user_login='aravikum'") or die "$DBI::errstr";

$sth->execute() or die "couldn't execute statementn$!";
$sth->rows;

#End of Program
$sth->finish();
$dbh->disconnect();

I got the error below:

Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libocci.so.11.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
 at perlupdt.pl line 11.
Compilation failed in require at perlupdt.pl line 11.
BEGIN failed--compilation aborted at perlupdt.pl line 11.

on googling, i got an answer like running the below export commands fixed the issue. so, i executed and it worked fine,

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib/oracle/11.2/client64/bin:$PATH

But, i cant execute the above commands each and every time when i login to putty,

I decided to put this export inside the script so added these at the starting of the script,

$ENV{"ORACLE_HOME"} = '/usr/lib/oracle/11.2/client64';
$ENV{"LD_LIBRARY_PATH"} = '/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH';
$ENV{"PATH"} = '/usr/lib/oracle/11.2/client64/bin:$PATH';

But I am getting the above stated error, please suggest a solution to import these commands inside my perl script.

LaintalAy
  • 1,162
  • 2
  • 15
  • 26
Avinash
  • 533
  • 5
  • 15
  • 3
    https://stackoverflow.com/questions/8657005/env-doesnt-work-and-i-cannot-use-shared-library?rq=1 – mob Oct 04 '17 at 14:26
  • Possible duplicate of [%ENV doesn't work and I cannot use shared library](https://stackoverflow.com/questions/8657005/env-doesnt-work-and-i-cannot-use-shared-library) – dgw Oct 04 '17 at 19:58
  • I tried to use the above provided solution, but i am getting the same error – Avinash Oct 05 '17 at 08:52
  • 1
    After setting the above export commands in the etc/profile and etc/bashrc and adding as an .sh file under etc/profile.d fixed the issue. – Avinash Oct 05 '17 at 09:41
  • @Avinash If that's the answer could you make it into an answer to this, then a day later accept it? – Ed. Aug 25 '18 at 18:55

1 Answers1

1

After setting the above export commands in the etc/profile and etc/bashrc and adding as an .sh file under etc/profile.d fixed the issue.

Avinash
  • 533
  • 5
  • 15