Browse Source

Connection Oracle OK!

boutils 10 years ago
parent
commit
678c676a6d
1 changed files with 34 additions and 56 deletions
  1. 34 56
      ajax/oracle.php

+ 34 - 56
ajax/oracle.php

@@ -1,53 +1,6 @@
 <?php
-error_reporting(E_ALL);
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
 
-echo phpinfo();
-/*
-Bonsoir à tous,
-Voici les informations de connexion transmis par le MePI pour l’appli d’éligibilité. Pour les tables Oracle en lecture, Stéphane ou Christophe pourront en détailler le contenu.
-Si souci technique sur ces accès, joindre Timothy THIEBOT par mail : timothy.thiebot@manche.fr
-
-Les informations de connexion pour le serveur p-web-56 :
-
-@IP : 10.0.45.67
-CentOs 7.0
-User : root
-Pwd : Php$1G
-
-Users mysql : root
-Pwd : zkrInpR3Yf
-
-User ftp "ELIGIBILITE" le mot de passe est dans /etc/vsftpd/login.txt
-Chemin du ftp /var/www/html
-
-compte pour l’accès en lecture seule sur la base SIGCG50 de P-BDD-16 :
-User oracle : ELIGIBILITE_R
-Pwd : H6nmb0KCwR
-
-Accès en lecture seule pour le compte ELIGIBILITE_R sur :
-Schéma SIG_ANT :
--          MIMO_ANTC_COUVERTURE_SSS OK
-
--          FTTH_MN_ZAPM_PARTIELLE OK
-
--          FTTH_MN_PRISE_LOT   OK
-
-
-
-Schéma SIG_REFERENTIEL :
--          TEL_FT_ADSL OK
-*/
-
-// MYDB =
-//      (DESCRIPTION =
-//        (ADDRESS = (PROTOCOL = TCP)(PORT = 1521))
-//        (CONNECT_DATA =
-//          (SERVER = P-BDD-16)
-//          (SERVICE_NAME = SIGCG50)
-//        )
-//      );
-
-//$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA=(SERVER = P-BDD-16)(SERVICE_NAME = SIGCG50)))";
 $db = "(DESCRIPTION =
           (ADDRESS_LIST =
             (ADDRESS = (PROTOCOL = TCP)(HOST = P-BDD-16)(PORT = 1521))
@@ -57,26 +10,51 @@ $db = "(DESCRIPTION =
           )
         )";
 
-echo 'Init connection ';
 
-// Connexion au service XE (i.e. la base de données) sur la machine "localhost"
-//$conn = oci_connect('ELIGIBILITE_R', 'H6nmb0KCwR', ' P-BDD-16/SIGCG50');
+// Connexion au service
 $conn = oci_connect('ELIGIBILITE_R', 'H6nmb0KCwR', $db);
 
-echo '$conn'.$conn;
 if (!$conn) {
     $e = oci_error();
     echo 'Not connected';
     echo trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
 }
 
-echo 'Connected';
 
-$stid = oci_parse($conn, 'SELECT * FROM Ftth_Mn_Zapm_Partielle');
-oci_execute($stid);
+$x = -1.109669152209201;
+$y = 49.102353729303125;
+
+$query1 = "Select A.Id_Zapm_Partielle From SIG_ANT.Ftth_Mn_Zapm_Partielle a WHERE SDO_CONTAINS(a.GEOMETRY, Mdsys.Sdo_Geometry(2001,4326,Mdsys.Sdo_Point_Type(".$x.", ".$y.", Null), Null, Null)) = 'TRUE'";
+
+$query2 = "SELECT * FROM SIG_ANT.Ftth_Mn_Zapm_Partielle";
+
+$query3 = "Select count(*) From SIG_ANT.Ftth_Mn_Zapm_Partielle";
+
+$query = $query1;
+
+$stid = oci_parse($conn, $query);
+
+if (!$stid) {
+  echo '<div style="color:red;">';
+  $e = oci_error($conn);  // Pour les erreurs oci_parse, passez le gestionnaire de connexion
+  trigger_error(htmlentities($e['message']), E_USER_ERROR);
+  echo '</div>';
+}
+
+$r = oci_execute($stid);
+if (!$r) {
+    echo '<div style="color:red;">';
+    $e = oci_error($stid);  // Pour les erreurs oci_execute, passez le gestionnaire de connexion
+    print htmlentities($e['message']);
+    print "\n<pre>\n";
+    print htmlentities($e['sqltext']);
+    printf("\n%".($e['offset']+1)."s", "^");
+    print  "\n</pre>\n";
+    echo '</div>';
+}
 
 echo "<table border='1'>\n";
-while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
+while ($row = oci_fetch_array($stid, OCI_BOTH)) {
     echo "<tr>\n";
     foreach ($row as $item) {
         echo "    <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "") . "</td>\n";