Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.3

Request #4539 cannot connect to Oracle with host/database
Submitted: 2005-06-06 16:05 UTC
From: antonomase at hotmail dot com Assigned:
Status: Duplicate Package: DB
PHP Version: 4.3.11 OS: Windows server
Roadmaps: (Not assigned)    
Subscription  


 [2005-06-06 16:05 UTC] antonomase at hotmail dot com
Description: ------------ It appears only when the Oracle database is on the same computer than PHP. When you install OCI like described by Oracle, you can no more connect to the local database using the tnsnames.ora eg : you cannot connect with $c1 = ocilogon("scott", "tiger", "mydatabase"); but it's OK with $c1 = ocilogon("scott", "tiger", "myserver/mydatabase"); With pear:db, you must use $dbh = DB::connect("oci8://scott:tiger@myserver/mydatabase"); But in the oci8.php file, the $dsn['database'] is ignored and the connection fails. So the right code is $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon'; if ($dsn['hostspec']) { if ($dsn['database']) { $this->connection = @$connect_function($dsn['username'], $dsn['password'], $dsn['hostspec'].'/'.$dsn['database']); } else { $this->connection = @$connect_function($dsn['username'], $dsn['password'], $dsn['hostspec']); } } elseif ($dsn['username'] || $dsn['password']) { $this->connection = @$connect_function($dsn['username'], $dsn['password']); }

Comments

 [2006-03-11 09:36 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!