Entry
How can I establish a connection to oracle?
how can I get an Oracle query result into a list box at a html page?
Aug 30th, 2004 16:46
Knud van Eeden, Bence Szabo, rene koerner, Matt Gregory, olivia ribo, http://www.vm.hu
In PHP there are two type of handling ORACLE databases.
First is the simple way, the functions based general ORACLE
functionality. The second is the more flexible OCI interface.
In PHP OCI functions two can be use to
establish connections:
ocilogon - to get simple session conn.
ociplogon - to get persistent conn.
The PHP manual has descriptions for theese.
To correctly setup PHP-APACHE system to use ORACLE
functons you should instal on the server the recent ORACLE
client libraries and should build PHP as statically
linked apache modul and put the following ORACLE env vars
in "apachectl" file:
ORACLE_BASE,ORACLE_HOME,ORACLE_NLS33
LD_LIBRARY_PATH=$LD_LIRARY_PATH:$ORACLE_HOME/lib:/usr/lib
NLS_LANG
The ORACLE related compile option for PHP in my system is:
--with-oracle=/data/ora/product/8.0.5
Simple example in PHP to demonstrate ORACLE functions:
<?php
print "<HTML><PRE>";
$db = "palpatine";
$c1 = ocilogon("scott","tiger",$db);
function select_data($conn)
{ $stmt = ociparse($conn,"select * from scott.emp");
ociexecute($stmt,OCI_DEFAULT);
echo $conn."----selecting\n\n";
while (ocifetch($stmt)){
echo ociresult($stmt,"EMPNO")." ";
echo ociresult($stmt,"HIREDATE")." ";
echo ociresult($stmt,"ENAME")."\n";
}
echo $conn."----done\n\n";
}
select_data($c1);
ocilogoff($c1);
print "</PRE></HTML>";
?>
Have fun.
----------------------------------------------------------------------
--- Knud van Eeden --- 31 August 2020 - 01:20 am ---------------------
Oracle has currently (starting from its Oracle 10g database) developed
a PHP add on for its Oracle Application server
http://www.oracle.com/technology/pub/articles/php_experts/index.html
http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/hu
ll_php.html
---
or you can e.g. look at this solution:
http://www.orafaq.com/faqphp.htm
---
---
Internet: see also:
---
[Internet: source: http://www.google.com search for 'oracle php':
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=oracle%20php]
----------------------------------------------------------------------