HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/MDalebout3/prdct.nl/wwwroot/timesheet/includes/adodb5/docs/docs-oracle.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
pre {
  background-color: #eee;
  padding: 0.75em 1.5em;
  font-size: 12px;
  border: 1px solid #ddd;
}
.greybg {
  background-color: #eee;
  padding: 0.75em 1.5em;
  font-size: 12px;
  border: 1px solid #ddd;
}
.style1 {color: #660000}
</style>
<title>ADOdb with PHP and Oracle</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</style>
</head>

<body>
<table width=100%><tr><td>
<h2>Using ADOdb with PHP and Oracle: an advanced tutorial</h2>
</td><td><div align="right"><img src=cute_icons_for_site/adodb.gif width="88" height="31"></div></tr></table>
<p><font size="1">(c)2004-2005 John Lim. All rights reserved.</font></p>
<h3>1. Introduction</h3>
<p>Oracle is the most popular commercial database used with PHP. There are many ways of accessing Oracle databases in PHP. These include:</p>
<ul>
  <li>The oracle extension</li>
  <li>The oci8 extension</li>
  <li>PEAR DB library</li>
  <li>ADOdb library</li>
</ul>
<p>The wide range of choices is confusing to someone just starting with Oracle and PHP. I will briefly summarize the differences, and  show you the advantages of using <a href="http://adodb.sourceforge.net/">ADOdb</a>. </p>
<p>First we have the C extensions which provide low-level access to Oracle functionality. These C extensions are precompiled into PHP, or linked in dynamically when the web server starts up. Just in case you need it, here's a <a href=http://www.oracle.com/technology/tech/opensource/php/apache/inst_php_apache_linux.html>guide to installing Oracle and PHP on Linux</a>.</p>
<table width="75%" border="1" align="center">
  <tr valign="top">
    <td nowrap><b>Oracle extension</b></td>
    <td>Designed for Oracle 7 or earlier. This is obsolete.</td>
  </tr>
  <tr valign="top">
    <td nowrap><b>Oci8 extension</b></td>
    <td> Despite it's name, which implies it is only for Oracle 8i, this is the standard method for accessing databases running Oracle 8i, 9i or 10g (and later).</td>
  </tr>
</table>
<p>Here is an example of using the oci8 extension to query the <i>emp</i> table of the <i>scott</i> schema with bind parameters:
<pre>
$conn = OCILogon("scott","tiger", $tnsName); 

$stmt = OCIParse($conn,"select * from emp where empno > :emp order by empno"); 
$emp = 7900;
OCIBindByName($stmt, ':emp', $emp);
$ok = OCIExecute($stmt);
while (OCIFetchInto($stmt,$arr)) {
	print_r($arr);
	echo "&lt;hr>";	
} 
</pre>
<p>This generates the following output:
<div class=greybg>
Array ( [0] => 7902 [1] => FORD [2] => ANALYST [3] => 7566 [4] => 03/DEC/81 [5] => 3000 [7] => 20 ) 
<hr />
  Array ( [0] => 7934 [1] => MILLER [2] => CLERK [3] => 7782 [4] => 23/JAN/82 [5] => 1300 [7] => 10 )
</div>
<p>We also have  many higher level PHP libraries that allow you to simplify the above code. The most popular are <a href="http://pear.php.net/">PEAR DB</a> and <a href="http://adodb.sourceforge.net/">ADOdb</a>.  Here are some of the differences between these libraries:</p>
<table width="75%" border="1" align="center">
  <tr>
    <td><b>Feature</b></td>
    <td><b>PEAR DB 1.6</b></td>
    <td><b>ADOdb 4.52</b></td>
  </tr>
  <tr valign="top">
    <td>General Style</td>
    <td>Simple, easy to use. Lacks Oracle specific functionality.</td>
    <td>Has multi-tier design. Simple high-level design for beginners, and also lower-level advanced Oracle functionality.</td>
  </tr>
  <tr valign="top">
    <td>Support for Prepare</td>
    <td>Yes, but only on one statement, as the last prepare overwrites previous prepares.</td>
    <td>Yes (multiple simultaneous prepare's allowed)</td>
  </tr>
  <tr valign="top">
    <td>Support for LOBs</td>
    <td>No</td>
    <td>Yes, using update semantics</td>
  </tr>
  <tr valign="top">
    <td>Support for REF Cursors</td>
    <td>No</td>
    <td>Yes</td>
  </tr>
  <tr valign="top">
    <td>Support for IN Parameters</td>
    <td>Yes</td>
    <td>Yes</td>
  </tr>
  <tr valign="top">
    <td>Support for OUT Parameters</td>
    <td>No</td>
    <td>Yes</td>
  </tr>
  <tr valign="top">
    <td>Schema creation using XML</td>
    <td>No</td>
    <td>Yes, including ability to define tablespaces and constraints</td>
  </tr>
  <tr valign="