connecting to remote ORACLE DB
| From: | Dirkson, Kevin | Date: | Wed, 18 Oct 2000 16:24:07 +0000 |
| Subject: | connecting to remote ORACLE DB | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3739@lists.php.net to get a copy of this message | ||
reading through numerous previous posts & B.B. hasn't helped, so here goes:
To connect to a remote ORACLE db, what do I have to do or what am I doing
wrong?
Machine 1: AIX, apache 1.3.12, PHP 4.0.1pl2 (--with-oracle), Oracle 7.3.4
db (ORACLE_SID=db1).
Machine 2: AIX, Oracle 7.3.4 db (ORACLE_SID=db2).
I can connect to the database on the same machine that apache/PHP is running
on just fine.
I can use SQL*Plus and connect to both databases from both machines.
The databases are setup the same and have exactly the same tnsnames.ora
files.
tnsnames.ora file (on both machines) has permissions "wide-open" so
everybody can access it. (until I get this working...)
--- Here is the PHP code ---
putenv("ORACLE_SID=db1");
putenv("ORACLE_HOME=/opt/oracle/product/7.3.4");
putenv("TNS_ADMIN=/opt/oracle/product/7.3.4/network/admin");
if (! $conn = ora_logon("user", "user"))
{
print "Error: " . ora_errorcode($conn);
exit;
}
else
{
print "SUCCESS!";
exit;
}
--------------------------------------
1) Above code works fine as is.
2) I change the ORACLE_SID to db2 and I get the following error:
Warning: Oracle: Connection Failed: ORA-01034: ORACLE not available in
/webdocs/test2.php on line 7.
3) I leave the ORACLE_SID at db1 and change the logon to read:
ora_logon("user", "user@db2") or ora_logon("user/user@db2",
"") [trying
to use SQLNET]
and get the following error:
Warning: Oracle: Connection Failed: ORA-01017: invalid username/password;
logon denied.
(that is the correct login/password)
I am at a loss here. Any help/information/requests for more info. would be
greatly appreciated.
Thanks,
Kevin Dirkson
Anchor Gaming (www.anchorgaming.com)