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

Bug #7216 OCI8 module ignores non-standard port
Submitted: 2006-03-27 07:57 UTC Modified: 2007-01-10 21:16 UTC
From: andrew_kerr at iamnos dot ca Assigned: aharvey
Status: Closed Package: DB (version 1.7.6)
PHP Version: 4.4.2 OS: Linux (RHEL4)
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-27 07:57 UTC] andrew_kerr at iamnos dot ca (Andrew Kerr)
Description: ------------ The OCI8 module will always attempt to connect to port 1521, even if a different port is specified in the DSN. Test script: --------------- $dsn = 'oci8://user:pass@10.10.10.1:1522/dbname'; $db =& DB::connect($dsn); if (DB::isError($db)) { echo "Failed connection\n"; } Expected result: ---------------- No error message. Actual result: -------------- Failed connection. A tcpdump shows that it is trying to connect on the default port (1521)

Comments

 [2006-03-27 08:07 UTC] lsmith (Lukas Smith)
Hmm .. specifying a port is only allowed with the easy connect syntax, or am I mistaken? so in that case the it should use: //[hostspec]:[port] if no port is specified it would simply use [hostspec] so if you want to use the easy connect syntax with the default port then you woulld need to include the "//" in the hostspec .. (actually one would need "///") can you verify this analysis?
 [2006-03-28 10:23 UTC] tom at greenleaftech dot net (Tom Haddon)
I'm not sure I understand what you're asking us to do to verify this bug and/or a workaround. You say "if no port is specified it would simply use [hostspec]", but the whole point is that we are trying to use a port. Can you advise what string to pass as a $dsn to connect using an instantclient when using an alternate port? Thanks, Tom
 [2006-03-30 13:28 UTC] lsmith (Lukas Smith)
I am proposing the following change in the code: Today if you want to use the easy connect syntax you would specifiy the entire easy connect string in the hostspec or database ('//hostname:port' or '//hostname'). With the change you could alternatively set the hostname either in the hostspec or database and if you also specify a port then an easy connect string would be assembled as you can see above.
 [2006-04-04 06:36 UTC] tom at greenleaftech dot net (Tom Haddon)
I can confirm that: $dbtype="oci8"; $dbuser="user"; $dbpass="pass"; $dbhost="///host"; $dbport="port"; $dbname="dbname"; works fine. I'm appending the port as well, as in my case, I'm using a non-standard port. $oradsn="$dbtype://$dbuser:$dbpass@$dbhost:$dbport/$dbname"; Thanks, Tom
 [2006-04-05 10:13 UTC] lsmith (Lukas Smith)
I have commited the change in MDB2 .. here is the proposed patch for DB retrieving revision 1.103 diff -u -r1.103 oci8.php --- oci8.php 11 Apr 2005 15:10:22 -0000 1.103 +++ oci8.php 30 Mar 2006 19:28:11 -0000 @@ -232,6 +232,9 @@ } else { $db = $dsn['database']; } + if (isset($this->dsn['port'])) { + $db = '//'.$db.':'.$this->dsn['port']; + }
 [2006-04-15 05:41 UTC] lsmith (Lukas Smith)
actually the following is propably right + if (isset($this->dsn['port']) && $this->dsn['port']) { + $db = '//'.$db.':'.$this->dsn['port']; + }
 [2007-01-10 21:16 UTC] aharvey (Adam Harvey)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.