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

Bug #4854 Oracle Easy Connect syntax only works with array DSN
Submitted: 2005-07-19 05:26 UTC
From: cjbj at hotmail dot com Assigned: quipo
Status: Closed Package: MDB2
PHP Version: 5.0.4 OS: Linux x86
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 47 - 8 = ?

 
 [2005-07-19 05:26 UTC] cjbj at hotmail dot com
Description: ------------ Oracle's "Easy Connect" syntax works with MDB2's array DSN, but not the string form. To use Easy Connect, Oracle 10g client libs are required. The Easy Connect syntax is username/password@[//]host[:port][/service_name] e.g. sqlplus scott/tiger@//mymachine:1521/orcl Reproduce code: --------------- require_once 'MDB2.php'; // This works $dsn = array( 'phptype' => 'oci8', 'hostspec' => '//mymachine/orcl', 'username' => 'scott', 'password' => 'tiger', ); // This doesn't connect $dsn = 'oci8://scott:tiger@//mymachine/oracle'; $db = MDB2::connect($dsn); Expected result: ---------------- Successful connection Actual result: -------------- The connection fails and $db->getDebugInfo() gives: [Error message: it was not specified a valid Oracle Service Identifier (SID)] ** oci8:///frodo/oracle:xxx@//frodo/oracle

Comments

 [2005-07-19 05:32 UTC] cjbj at hotmail dot com
The service name typo in my example is not the cause of the problem. Even with "orcl" in the failure-case example, the connection does not succeed.
 [2005-08-09 14:33 UTC] david dot coallier at gmail dot com
What if you try this: $dsn = array( 'phptype' => 'oci8', 'hostspec' => 'hostname', 'username' => 'scott', 'password' => 'tiger', 'database' => 'orcacle', );
 [2005-08-13 16:00 UTC] davidc at phpsec dot org
Please reply, I will close this issue in 3 days. Thank you David
 [2006-12-18 23:37 UTC] cjbj at hotmail dot com
This bug still exists. The DSN parsing overwrites the username. Looking in _doConnect() in Driver/oci8.php, the DSNs oci8://hr:hr@localhost/XE and $dsn = array( 'phptype' => 'oci8', 'hostspec' => 'hostname', 'username' => 'scott', 'password' => 'tiger', 'database' => 'XE', ); were previously both parsed with username set to XE, hostspec set to localhost and database set to false. (BTW, protocol is set to "tcp" with the former but not the latter code) Workaround: This array DSN connects correctly: $dsn = array( 'phptype' => 'oci8', 'username' => 'hr', 'password' => 'hr', 'hostspec' => '//localhost/XE' );
 [2007-01-31 11:58 UTC] quipo (Lorenzo Alberton)
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.
 [2007-02-03 13:07 UTC] priyadi (Priyadi)
the fix breaks sqlite DSN: sqlite:////full/unix/path/to/file.db?mode=0666 now parsed as: Array ( [phptype] => sqlite [dbsyntax] => sqlite [username] => [password] => [protocol] => tcp [hostspec] => //full/unix/path/to/file.db?mode=0666 [port] => [socket] => [database] => [mode] => ) previously it was: Array ( [phptype] => sqlite [dbsyntax] => sqlite [username] => [password] => [protocol] => tcp [hostspec] => [port] => [socket] => [database] => /full/unix/path/to/file.db [mode] => ) please reverse the changes. IMHO, parseURL() in MDB2.php is not broken. it is the oci8 driver that should rewrite MDB2 parsed DSN into oracle easy connect syntax if the underlying oci_connect() expects oracle easy connect syntax. in the mean time, the original submitter could use something like oci8://scott:tiger@%2F%2Fmymachine%2Forcl as workaround. i will try to get my hands into oracle driver very shortly.
 [2007-02-03 13:24 UTC] quipo (Lorenzo Alberton)
Fixed in CVS, thanks.
 [2007-02-03 17:29 UTC] priyadi (Priyadi)
my proposed fix to the oracle driver has been submitted as bug #10018