×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Connecting to Oracle with PHP

Connecting to Oracle with PHP

Connecting to Oracle with PHP

(OP)
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

RE: Connecting to Oracle with PHP

Try using REMPRD02 instead of MISPRDS1:
$conn = oci_connect("myid", "mypass", "10.182.237.53/MISPRDS1");

According to http://php.net/manual/en/function.oci-connect.php, you should be using the connection name from tnsnames.ora.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close