Some tips in case of errors:- If the compilator (gcc) vous dit say that it can't found headers (.h), enter: $ oracle-instantclient-config --cflags and check that the instantclient header files are located in the returned directory ( after the -I parameter) - If the linker (ld) complains about missing libraries (*.so.*), enter: $ oracle-instantclient-config --libs and check that the instantclient libraries are located in the returned directory ( after the -L parameter) In case of one of the two checks failes, go back to the 4.2 step to correctly adapt the oracle-instantclient-config file. |
#!/usr/bin/perl $oracle_server="server"; $oracle_listener="listener"; $oracle_sid="SID"; $oracle_port="PORT"; $oracle_user="user"; $oracle_password="password"; $oracle_testing_table="TABLE"; use DBI; use DBD::Oracle; my $dbh = DBI->connect("dbi:Oracle:host=$oracle_server;port=$oracle_port;sid=$oracle_sid", $oracle_user, $oracle_password) or die "Impossible de se connecter à la base Oracle : " . DBI->errstr; my $sth = $dbh->prepare("SELECT * FROM $oracle_testing_table") or die "Impossible de preparer la requette: " . $dbh->errstr; $sth->execute() or die "Impossible d'exécuter la requette: " . $sth->errstr; while ( my @data = $sth->fetchrow_array() ) { my $firstname = $data[1]; my $id = $data[2]; print "\t$id: $firstname $lastname\n"; } if ($sth->rows == 0) { print "Table vide\n"; } $sth->finish; $dbh->disconnect; |