- Deleted `cluster-detail2.php`, `constants.inc copy.php`, `D.php`, and `Dashboard2.php`. These files were no longer in use and contributed to unnecessary clutter in the codebase. - Cleaned up references to removed files.
47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?php
|
|
// Temporarily enable all error reporting to catch details from odbc_connect
|
|
// error_reporting(E_ALL); // Uncomment this line if you still don't get enough info
|
|
|
|
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER - F_DB2_clidriver};" .
|
|
"DATABASE=AIXCMDB; " .
|
|
"HOSTNAME=db2_aixcmdb.appliarmony.net;" .
|
|
"PORT=50000; " .
|
|
"PROTOCOL=TCPIP; " .
|
|
"UID=aixcmdb;" .
|
|
"AUTHENTICATION=SERVER;" .
|
|
"PWD=aixcmdb;";
|
|
|
|
$conn = odbc_connect($conn_string, "", "");
|
|
|
|
if (!$conn) {
|
|
// --- IMPORTANT: Récupérer le message d'erreur ODBC détaillé ---
|
|
$error_message = "ODBC Connect Error: " . odbc_errormsg() . " (" . odbc_error() . ")";
|
|
echo "Pas de connexion : " . $error_message . "<br>";
|
|
// Pour débogage, tu peux aussi loguer cette erreur dans un fichier
|
|
// error_log($error_message);
|
|
return "ERROR: Could not connect to DB2. Check connection string and ODBC setup."; // Retourne une erreur pour éviter l'appel à odbc_exec
|
|
}
|
|
|
|
$rs = odbc_exec($conn, $request);
|
|
|
|
// Ton code existant après la connexion
|
|
if (strpos(strtoupper($request), "SELECT") !== false) { // strpos est plus robuste que instr ici en PHP
|
|
$answer = []; // Initialize array to prevent undefined variable warning
|
|
while ($row = odbc_fetch_array($rs)) {
|
|
$answer[] = $row;
|
|
}
|
|
}
|
|
|
|
if (isset($answer)) {
|
|
return $answer;
|
|
} else {
|
|
if ($rs) {
|
|
return "OK";
|
|
} else {
|
|
// If odbc_exec failed
|
|
error_reporting(E_ALL); // Re-enable for this specific error if needed
|
|
return "ERROR : " . odbc_errormsg($conn);
|
|
}
|
|
}
|
|
|