It's possible if you set 'persistent' => false in your database.php
config file and use $useDbConfig in your models.

Example config/database.php:
$dbOne = array
(
        'driver'    => 'mysql',
        'connect'  => 'mysql_connect',
        'host'     => 'localhost',
        'login'    => 'root',
        'password' => 'pswd',
        'database' => 'test',
        'prefix'    => '',
        'encoding' => 'UTF8',
        'persistent' => false
);

$default = array
(
        'driver'    => 'mysql',
        'connect'  => 'mysql_connect',
        'host'     => 'localhost',
        'login'    => 'root',
        'password' => 'pswd',
        'database' => 'test',
        'prefix'    => '',
        'encoding' => 'UTF8',
        'persistent' => false
);

Model One:
class ModelOne extends AppModel
{
        var $name = 'ModelOne';
        var $useDbConfig = 'dbOne';

}

Model Two:
class ModelTwo extends AppModel
{
        var $name = 'ModelTwo';
        var $useDbConfig = 'default';

}

HTH,
Ryan Rose
http://www.digiwize.com

On Mar 15, 1:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I was wondering if it would be possible to use two databases in cake.
> Some models would access tables in one database and other models would
> access tables in another database.
>
> Thanks
>
> Guy


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to