Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to Oracle with PHP

Status
Not open for further replies.

Mingas

Programmer
Jul 10, 2013
15
ZA
Guys please help. I have been tasked to create a php page that would connect to an Oracle DB given the below:

Table name that is holding the Solutions info is called: REMMIS2.PBM_SOLUTION_DATABASE

Please see below the TNS connection string.
User id = myid
Password = mypass

REMPRD02=
(DESCRIPTION =
(FAILOVER = ON)
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.53)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.53)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.53)(PORT = 1721))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.53)(PORT = 1722))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.54)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.54)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.54)(PORT = 1721))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.237.54)(PORT = 1722))
(CONNECT_DATA =
(SERVICE_NAME = MISPRDS1)
(FAILOVER_MODE =
(TYPE = session)
(METHOD = basic)
(DELAY = 5)
(RETRIES = 100)
)
)
)


What I have tried is :

<?php
// Create connection to Oracle
$conn = oci_connect("myid", "mypass", "10.182.237.53/MISPRDS1");
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!";
}
// Close the Oracle connection
oci_close($conn);
?>

But I cannot establish a connection. I'm not sure if i would first need download instantclient package from Oracle for my server that is running PHP or if my code is wrong. Please assist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top