[support] Using two databases
Chris Johnson
cxjohnson at gmail.com
Wed Dec 13 15:17:20 UTC 2006
On 12/12/06, Morbus Iff <morbus at disobey.com> wrote:
> In the above code, where are you specifying the
> connection details for the new (second) database?
>
In my settings.php file, like this:
$db_url['default'] = 'mysql://user:password@server/drupal';
$db_url['alt_db1'] = 'mysql://user:password@host1/database1';
$db_url['alt_db2'] = 'mysql://user:password@host2/database2';
The db_set_active() function seems smart enough to choose from the
array, and the core DB layer seems smart enough to make the connection
on the first query. IIRC. :-/
Am I missing something? My code works, but I wrote it a long time ago
and haven't looked at it since.
More information about the support
mailing list