<?php
//Connect String
$db="(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)
(HOST=REMOTE_DB_IP)(PORT=XXXX)
)
)
(CONNECT_DATA=(SID=ORACLE_SID))
)";
//Connect to DB
$conn = oci_connect('USERNAME','PASSWORD',$db);
//Run a sample query
$s = oci_parse($conn, 'select * from DB_TABLE');
oci_execute($s);
oci_fetch_all($s, $res);
echo "<pre>\n";
var_dump($res);
echo "</pre>\n";
//Close DB Connection
oci_close($conn);
?>
Wednesday, August 22, 2012
Using PHP/oci8 to Connect to Oracle Remote DB
With this short PHP script, you can see how I connect to a remote Oracle DB:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment