What version of Cake are you using?
On Apr 9, 5:40 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> Thanks for the quick response. Unfortunately, that didn't do it.
>
> Here's the modified app/config/database.php
>
> class DATABASE_CONFIG
> {
> var $default = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'publicschoolworks',
> 'persistent' => false,
> 'prefix' => '');
>
> var $pbs = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'pbs',
> 'persistent' => false,
> 'prefix' => '');
>
> var $test = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => 'user',
> 'password' => 'password',
> 'database' => 'project_name-test',
> 'prefix' => '');
>
> }
>
> And the models:
>
> <?
> class Customer extends AppModel
> {
> var $name = 'Customer';}
>
> ?>
>
> <?
> class Student extends AppModel
> {
> var $name = 'Student';
> var $useDbConfig = 'pbs';
>
> var $belongsTo = array(
> 'Customer' => array('className' => 'Customer')
> );}
>
> ?>
>
> Let me know if you can think of something else.
>
> Thanks,
> Sergei
>
>
>
> On Tue, Apr 10, 2007 at 12:05:05AM -0000, BlenderStyle wrote:
>
> > I ran into this too. One of the database configs has to be default. So
> > change $psw to $default, and remove var $useConfig in your customer
> > model (it uses default by, well, default).
>
> > If persistent is set to true, you can't use two configs
> > simultaneously. I'm guessing if persistent is true, and the default
> > database config (host, username, password, database) is used, it keeps
> > that connection open. Then, when your other model comes into play it
> > will try to use the same connection.
>
> > On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> > wrote:
> > > > You're welcome. In doing this, I learned about the persistent key, so
> > > > everyone wins. Let us know how it goes.
>
> > > Just tried this at home and I'm baffled with this error: Cannot redeclare
> > > class dbosource in
> > > /var/www/cake/cake/libs/model/datasources/dbo_source.php
>
> > > Here's my setup:
>
> > > app/config/database.php:
> > > =======================
>
> > > var $psw = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'psw',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > > var $pbs = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'pbs',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > > app/models/student.php
> > > =======================
> > > <?
> > > class Student extends AppModel
> > > {
> > > var $name = 'Student';
> > > var $useDbConfig = 'pbs';
>
> > > var $belongsTo = array(
> > > 'Customer' => array('className' => 'Customer')
> > > );}
>
> > > ?>
>
> > > app/models/customer.php
> > > =======================
> > > <?
> > > class Customer extends AppModel
> > > {
> > > var $name = 'Customer';
> > > var $useDbConfig = 'psw';}
>
> > > ?>
>
> > > Am I missing something?
>
> --
>
> Sergei Gerasenko
> IT Department
> PublicSchoolWORKS
> Phone: (513)-631-6111
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---