Home » Database » MDB2 » Bug #2532
bad parameters sent from MDB2_Driver_oci8::connect() to MDB@_Driver_oci8::_doCo
Details
| Submitted | 2004-10-14 18:09 UTC |
|---|---|
| From | michael dot caplan at lechateau dot ca |
| Assigned | lsmith |
| Status | Closed |
| Package | MDB2 |
| PHP Version | Irrelevant |
| OS | irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-10-14 18:09 UTC] michael dot caplan at lechateau dot ca
Description:
------------
when building a new connection to an oracle db, MDB2_Driver_oci8::connect() sends the wrong parameters to MDB@_Driver_oci8::_doConnect().
MDB2_Driver_oci8::connect($database_name, $this->dsn['password'], $this->options['persistent'])
but:
MDB2_Driver_oci8::_doConnect($username, $password, $persistent = false)
Notice that connect() does not send the username from the DSN, but the database name. it then trys to do an ociplogon () with the incorrect parameters.
[2004-10-14 18:15 UTC] smith at backendmedia dot com
This is actually the indended behaviour. The problem is that oracle lacks the concept of a "database" in the way mysql and other RDBMS deal with it. This is why MDB[2] emulates this behaviour with users. I admit this is not a beautiful solution by any means but its the best I could come up with (actually I stole this idea from Metabase).
Maybe I should optionally make it possible to use the standard username.
[2004-10-14 18:35 UTC] michael dot caplan at lechateau dot ca
I have to admit that the Oracle way of doing things is pretty foreign to me (my background is mysql).
That aside, I don't fully understand what you are getting at. Besides Oracle lacking the concept of a database in the same way MySQL does (which I understand), ociplogon() requires a username password and a "db string" (what dsn parses as host or pulls from the environmental vars) in that order. Connect() passes database_name, password, and persistance flag, but _doConnect() takes username, password, and persistance flag. This results in incorrect parameters being sent to ociplogon().
(As an aside, i've been using MDB2 on another server running oracle with no problem. when checking out why that was working and not the connection to a new oracle db, I noticed that my username and database name where the same, so the problem doesn't apply).
Thanks!
[2004-10-14 18:39 UTC] smith at backendmedia dot com
Let me explain a bit more:
There are methods in MDB2 to create a new database. For oracle MDB2 creates a new user with that database name and prepends the database_name_prefix option. This is the best way I could find to group tables by a name in oracle. Therefore if you dont want this behaviour you actually have to set the database name to the username you want to connect with.
[2004-10-14 19:33 UTC] michael dot caplan at lechateau dot ca
hey Lukas,
I understand what you are saying, but the Oracle guys I'm working with are scratching there heads. According to them, oracle does have a concept of a database, although different -- but similar -- from mysql. Truthfully, I haven't a clue.
Anyway, this aside, from what I understand you are using a convention that says all database and user names should be interchangable. Sounds like a reasonalbe convention, but convention aside, building an oracle connection means passing it the wrong parameter. If we adhear to the convention, all works a-okay. I'm wondeing then if it is a good idea to enforce such conventions in MDB[2]. It certainly makes MDB[2] less portable.
thanks for your time.
Michael
[2004-10-14 19:39 UTC] smith at backendmedia dot com
I am the last one to claim that I am an oracle expert. If there is a more logical approach to group tables and having them accessable via a name then let me know.
The idea is however that things like the dsn will likely be defined outside of the application in a configuration file, while grouping of tables into a "database" will more likely be embedded into your application. It may be that inside your application you change the database you are working with. This is why MDB2 emulates the database concept for oracle. Therefore I dont feel that this makes MDB2 less portable. It does make things a bit confusing. One possible solution would be to use the "username" if no "database" is set. How does that sound for you?
[2004-10-14 19:58 UTC] michael dot caplan at lechateau dot ca
Your suggestion makes good sence to me. It certainly would help make Oracle/MDB2 use a little easier for non savy Oracle guys like me :)
Thanks,
Michael
[2004-10-18 10:45 UTC] smith at backendmedia dot com
This bug has been fixed in CVS.
In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.
In case this was a pear.php.net website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PEAR better.
I have added a new "emulate_database" option to the oracle driver that defaults to true.