Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't locate DBI.pm

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!

like image 287
chaw359 Avatar asked Dec 13 '13 14:12

chaw359


People also ask

What is DBI PM?

Perl's Database Interface The DBI is the standard database interface module for Perl. It defines a set of methods, variables and conventions that provide a consistent database interface independent of the actual database being used.

How do you calculate DBI?

A reference dipole antenna is defined to have 2.15 dBi of gain. So converting between dBi and dBd is as simple as adding or subtracting 2.15 according to these formulas: dBi = dBd + 2.15.


2 Answers

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

sudo apt-get install libdbi-perl 
like image 100
Michu93 Avatar answered Oct 02 '22 23:10

Michu93


If you don't have active perl (and hence don't have ppm), you can also get DBI like this:

perl -MCPAN -e 'install DBI' 

You may need to install drivers for Postgres like this:

perl -MCPAN -e 'install DBD::Pg' 
like image 31
user216268 Avatar answered Oct 03 '22 00:10

user216268