MDB2: How to use two separate DSNs?
| From: | J. Norment | Date: | Thu, 04 Jan 2007 11:02:35 +0000 |
| Subject: | MDB2: How to use two separate DSNs? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26250@lists.php.net to get a copy of this message | ||
I have an application that needs to be connected to two separate DSNs: One MySQL, another ODBC -- possibly, one right after the other. I think this rules out the singleton method of instantiating a database object, and I think connect() will need to be used, as there is no caching in the application.
I plan on assigning two different DSNs to two different variables, possibly within a singleton type wrapper. Do I need to connect and destroy with every query? MDB2 isn't persistent across php pages, is it? (I don't think that is possible in a stateless environment, but I'm not sure.)
The only book that I'm aware of that deals directly with PHP patterns is written in German... so I'm really not aware of what I will need to do to implement a singleton pattern in PHP in a stateless environment, nor what that entails to the database connection...
Finally, I'm aware that MDB2 currently does not support ODBC -- I plan on porting that myself from MDB.
Am I on the right track?