PHP : Function Reference : Oracle Functions (PDO_OCI)
Warning: This extension is
EXPERIMENTAL. The behaviour of this extension --
including the names of its functions and anything else documented
about this extension -- may change without notice in a future release of PHP.
Use this extension at your own risk.
PDO_OCI is a driver that implements the PHP Data
Objects (PDO) interface
to enable access from PHP to Oracle databases through the OCI library.
Table of Contents
-
PDO_OCI DSN — Connecting to Oracle databases
cursade
if oracle and oracle instant client has been installed,
without db in the same host
For UNIX/LINUXï¼set $LD_LIBRARY_PATH
appent your instant client path and client/lib path to it,
For windows set PATH like this
After set the path ,set TNS_ADMIN everioment ,point to
where tnsnames.ora located.
Then,you can use service name to connect to your Database
Test coding
<?php
$param = $_POST;
$db_username = "youusername";
$db_password = "yourpassword";
$db = "oci:dbname=yoursid";
$conn = new PDO($db,$db_username,$db_password);
$name = $param['module'];
$file = $param['file'];
$stmt = $conn->exec("INSERT INTO AL_MODULE (AL_MODULENAME, AL_MODULEFILE) VALUES ('$name', '$file')");
?>
moc.aciremi@yvelj
A Statement of Warning:
PDO::oci does not support REF CURSORS.
This is mentioned nowhere (until now!) on this page.
And now you know!
If you want ref cursors avoid PDO for now.
My Reference for this claim: http://www.oracle.com/technology/pub/articles/
php_experts/otn_pdo_oracle5.html
GREAT article, excellent piece, really. It's not clear to me
how old this document is, but it must have some dust on it,
given it's references to "PHP5.1 ...' which is a little way off yet' "
... as of 2006-06-01, PHP5.1 has been with us for quite some time.
|