Re: DataObject with Multiple Databases
| From: | Justin Patrin | Date: | Thu, 04 Dec 2003 06:29:29 +0000 |
| Subject: | Re: DataObject with Multiple Databases | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9289@lists.php.net to get a copy of this message | ||
There are settings for multiple DBs in the ini files. Look at http://pear.php.net/manual/en/package.database.db-dataobject.intro-configuration.php
Configuration Options - Multiple Databases (optional)
database_* string
When you have multiple databases you can use the database_* to specify the DSN for each database
Example 20-4. using multiple databases - database passwordsdatabase_authentication = mysql://user:password@localhost/authentication
database_sales = mysql://user:password@localhost/salestable_* string
When you have multiple databases you can use the table_* configuration variables to map individual tables to different databases, for example
Example 20-5. using multiple databases - table settings
table_users = authenticationtable_saleslog = sales
table_stock = salesSteve Lianoglou wrote:
I'm wondering if (and how) it would be possible to use DB_DataObjects to access two different databases (not just separate tables, but separate databases with different usernames/pwords) "at the same time" (in the same application). It seems to me that the DataObject class stores it's db connection info in the $GLOBALS['_DB_DATAOBJECT']['CONFIG'] array and always hooks into that global variable to get the db name, pword, etc ... leaving no space to put connection info in for a second dbase ... is there a work around? thanks, -steve