cat demo.pl
#!/usr/bin/perl -w
#
use DBI;
my $dbh = DBI->connect("dbi:Informix:stores7")
or die "Can't connect to Informix";
my $prep = "select call_code, code_descr from call_type";
my $sth = $dbh->prepare($prep);
$sth->execute( );
while ($row = $sth->fetchrow_hashref()) {
print "Row : $row->{call_code}\t$row->{code_descr}\n";
}
$dbh->disconnect;
exit;
|
| Si lo ejecutamos y nos manda el siguiente error, significa que no esta
instaslado el DBI, y tenemos que seguir los pasos anteriores para instalarlo.
|
|
./demo.pl
|
Can't locate DBI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at ./demo.pl line 3.
BEGIN failed--compilation aborted at ./demo.pl line 3.
|
| Si lo ejecutamos y nos manda el siguiente error significa que no esta instalado
el DBD para Informix, tambien tenemos que seguir los pasos anteriores:
|
|
./demo.pl
|
install_driver(Informix) failed: Can't locate DBD/Informix.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at (eval 1) line 3.
Perhaps the DBD::Informix perl module hasn't been fully installed,
or perhaps the capitalisation of 'Informix' isn't right.
Available drivers: DBM, ExampleP, File, Proxy, Sponge.
at ./demo.pl line 4
|
| Si lo ejecutamos y nuestra la informacion todo esta correctamente instalado:
|
|
|
./demo.pl
|
Row : B billing error
Row : D damaged goods
Row : I incorrect merchandise sent
Row : L late shipment
Row : O other
|
| A continuacion voy a simular una falla para ver como nos manda los errores
Perl, En este caso el servidor de base de datos no existe:
|
|
export INFORMIXSERVER=nada
./demo.pl
|
DBI connect('stores7','',...) failed: SQL: -25596: The INFORMIXSERVER value is not listed in the sqlhosts file or the Registry. at ./demo.pl line 4
Can't connect to Informix at ./demo.pl line 4.
|
|
finderr 25596
|
-25596 The INFORMIXSERVER value is not listed in the sqlhosts file or the Registry.
The default database server name that the INFORMIXSERVER environment
variable specifies must be a valid database server name in the file
$INFORMIXDIR/etc/sqlhosts on UNIX or the registry on Windows. Check
that the specified server is listed in the sqlhosts file or the
registry.
|