我正在尝试启动这个脚本:
#!/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);
当我启动这个脚本我收到这个错误:
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.
我已经安装好了!安装了DBI.pm!
解决方法
如果您在控制台中有root类型(Debian / Ubuntu):
sudo apt-get install libdbi-perl