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

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] lsmith
Since we need a unified solution to these issues I am marking this bug as a duplicate to #4104.