Can't locate DBI.pm

chaw359 picture chaw359 · Dec 13, 2013 · Viewed 61.9k times · Source

I'm trying to launch this script:

#!/usr/bin/perl 

use DBI;

my $dbh = DBI->connect( 'dbi:Oracle:host=lonlin2;sid=TIMFX1AD;port=1524','xbsesdbo','xbsesdbo123' )  || die ( $DBI::errstr . "\n" );

my $query= "SELECT * FROM product_elements WHERE element_id = 1001";
my $queryHandler= $dbh->prepare($query);

my $result= $queryHandler->execute();


open(fileHandler,"> note.txt");

print fileHandler "Risultato query: $result\n";

my $e= $dbh->disconnect();
close(fileHandler);

When I launch this script I receive this error:

Can't locate DBI.pm in @INC (@INC contains: /opt/perl_32/lib/5.8.3/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/5.8.3 /opt/perl_32/lib/site_perl/5.8.3/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/site_perl/5.8.3 /opt/perl_32/lib/site_perl /opt/perl_32/lib/vendor_perl/5.8.3/IA64.ARCHREV_0-thread-multi /opt/perl_32/lib/vendor_perl/5.8.3 /opt/perl_32/lib/vendor_perl .) at ./prova.pl line 3.

I've got all installed! DBI.pm is installed!

Answer

Michu93 picture Michu93 · Aug 13, 2015

If you have root, type in console (Debian/Ubuntu):

sudo apt-get install libdbi-perl