PHP Classes

File: oracleconnectmanagerexample

Recommend this page to a friend!
  Classes of Mohammad Ashrafuddin Ferdousi   Oracle Connection Manager   oracleconnectmanagerexample   Download  
File: oracleconnectmanagerexample
Role: Example script
Content type: text/plain
Description: this is an example to use oracle connect manager
Class: Oracle Connection Manager
Establish connections with Oracle databases
Author: By
Last change: example file name changed.
Date: 12 years ago
Size: 1,280 bytes
 

Contents

Class file image Download
<?php
/*****
 * Example of OracleConnectManager class.
 *
 *
 *
 * Written by Mohammad Ashrafuddin Ferdousi.
 * email: it.codeperl@gmail.com
 * Licensed under GNU, GPL.
 *
 *
 */
 //including the oracle_connect_manager.php to available the OracleConnectManager Class.
 
require_once('oracle_connect_manager.php');
//Creating an object of OracleConnectManager Class.
 
$oracleManagerClass = new OracleConnectManager();
//Set the connection.
 
$oracleManagerClass->setConnection();
//Establishing the oracle connection. The paramiters are set by the OracleConnectionManager class's Default values.
 
$conn = $oracleManagerClass->establishConnection();
//if connection success enter the condition and execute the query. else echo message and exit.
 
if ($conn) {
     
$stid = oci_parse($conn, "SELECT * FROM your_table_name");
     
oci_set_prefetch($stid, 60);
     
oci_execute($stid);
 
     
$data = array();
      while ((
$row = oci_fetch_array($stid, OCI_ASSOC))) {
         
$data[] = $row;
      }
     
oci_free_statement($stid);
     
oci_close($conn);
  } else {
      echo
'Database Connection Error!';
      exit();
  }
//print the fetched data as an array.
 
print('<pre>');
 
print_r($data);
  print(
'</pre>');
//end
?>