$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 10.126.11.15)(PORT = 1521)))(CONNECT_DATA=(SID=ORAPBD7)))";
if ($c=OCILogon("username", "password", $db)) {
echo "Successfully connected to Oracle.\n";
OCILogoff($c);
} else {
$err = OCIError();
echo "Connection failed." . $err[text];
You can find the connection string "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.126.11.15)(PORT = 1521)))(CONNECT_DATA=(SID=ORAPBD7)))" in file named tnsnames.ora. In this connection, the Oracle server has ip address 10.126.11.15 with default port 1521. "ORAPBD7" is the name of database in the server that we'll manipulate later. You can save the php file in your web server (like Apache or IIS). Suppose we save it as "connection.php" and to access this file, type http://localhost/connection.php. If connection successfull, the browser will print "Successfully connected to Oracle.". Unless, you will get a message "Connection failed.".
Okey, it's something I can write for you today. You will find my post in this blog too. Thanks for reading.
Life is full with light of grey. Make it colourful with a pray. Good luck!
Special thanks for my best friend: Abid
2 comments:
Connection and other PHP and Oracle tips are discussed in the free Underground PHP and Oracle manual at http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf
It's very nice to hear I've a friend like you. What's your blog Chris?
Post a Comment