Bonjour,
J'utilise perl pour une connexion à un DB Oracle 11.2. Quand j'exécute ma requête avec sqlplus, tout fonctionne mais quand j'utilise perl (module DBI + DBD Oracle) je n'ai pas d'erreur mais pas de valeur non plus.
Mon code:
Ensuite l'instruction $selecth->{'host'} ne retourne aucune valeur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 use strict; use DBI; use DBD::Oracle; $ENV{'ORACLE_HOME'} = "/app/oracle/product/11.2/db_1"; $ENV{'LD_LIBRARY_PATH'} = "/app/oracle/product/11.2/db_1/lib"; my $dbh; my $selecth; my $error; #try to check if zabbix knows about this IP eval { $dbh = DBI->connect("DBI:Oracle:$DB_NAME", $DB_USER, $DB_PASS, {'RaiseError' => 1} ); $selecth = $dbh->selectrow_hashref("select h.hostid hostid, h.host host, i.ip ip from hosts h, interface i where h.hostid = i.hostid and i.type = 2 and i.main = 1 and i.ip='$ipaddress'");
Si quelqu'un a une idée...
Merci d'avance.
Olivier.
Partager