Re: Associations cross databases

2007-02-21 Thread safl

Grant Cox's reply solved my issue.

Having a db config setup with "persistent = false" is REQUIRED for it
to work (as nate states) but it is not sufficient.
Login/pass needs to be different (at least with MySQL DBMS) for each
dbconfig as Grant Cox states.

Then associations across databases works.

My issue is solved, i am very thankful!
This great journey of CakePHP continues, I'm loving it :)

On Feb 21, 5:01 am, "nate" <[EMAIL PROTECTED]> wrote:
> All you have to do is set the 'persistent' key to false in both
> connections, and the driver will set the $new_link parameter itself.
>
> On Feb 20, 6:53 pm, "Grant Cox" <[EMAIL PROTECTED]> wrote:
>
> > It should just work - just make sure you have the appropriate
> > connections in your app/config/database.php, and that each model has
> > the appropriate $useDbConfig set.
>
> > The only thing that can mess it up, is a bug, apparently in MySQL,
> > where connections to multiple databases need to have different
> > usernames and passwords. So, in your app/config/database.php, each
> > connection needs to connect with a different username/password.
>
> > I found out about this from someone on the IRC channel (probably
> > PhpNut) some months ago, but I didn't keep a note of any urls for more
> > information...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Associations cross databases

2007-02-20 Thread nate

All you have to do is set the 'persistent' key to false in both
connections, and the driver will set the $new_link parameter itself.

On Feb 20, 6:53 pm, "Grant Cox" <[EMAIL PROTECTED]> wrote:
> It should just work - just make sure you have the appropriate
> connections in your app/config/database.php, and that each model has
> the appropriate $useDbConfig set.
>
> The only thing that can mess it up, is a bug, apparently in MySQL,
> where connections to multiple databases need to have different
> usernames and passwords. So, in your app/config/database.php, each
> connection needs to connect with a different username/password.
>
> I found out about this from someone on the IRC channel (probably
> PhpNut) some months ago, but I didn't keep a note of any urls for more
> information...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



RE: Associations cross databases

2007-02-20 Thread Mariano Iglesias

Set the $new_link parameter to true to force a new link even if user &
password is the same:

http://ar.php.net/mysql_connect

resource mysql_connect ( [string $server [, string $username [, string
$password [, bool $new_link [, int $client_flags] );

Though that should be necessary when calling mysql_connect with the same
parameters.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Grant Cox
Enviado el: Martes, 20 de Febrero de 2007 08:54 p.m.
Para: Cake PHP
Asunto: Re: Associations cross databases

The only thing that can mess it up, is a bug, apparently in MySQL,
where connections to multiple databases need to have different
usernames and passwords. So, in your app/config/database.php, each
connection needs to connect with a different username/password.

I found out about this from someone on the IRC channel (probably
PhpNut) some months ago, but I didn't keep a note of any urls for more
information...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Associations cross databases

2007-02-20 Thread Grant Cox

It should just work - just make sure you have the appropriate
connections in your app/config/database.php, and that each model has
the appropriate $useDbConfig set.

The only thing that can mess it up, is a bug, apparently in MySQL,
where connections to multiple databases need to have different
usernames and passwords. So, in your app/config/database.php, each
connection needs to connect with a different username/password.

I found out about this from someone on the IRC channel (probably
PhpNut) some months ago, but I didn't keep a note of any urls for more
information...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Associations cross databases

2007-02-20 Thread safl

Hey Bakers!

Is it possible to utilize cakePHP for setups with cross database
joins?

F.ex. 3 Databases: "crm", "monitoring", "helpdesk".

I then want to find a specific Customer (stored in "crm") join with
all associated "Host" (stored in "monitoring"), and lastly join
"Ticket" (stored in "helpdesk").

In plain vanilla it would be something like:

SELECT h.*, c.*, t.*
FROM monitoring.hosts AS h, crm.customers AS c, helpdesk.tickets
WHERE
c.id = 'some_int' AND
h.cust_id = c.id AND
t.cust_id = c.id

I've tried using "useDbConfig" and playing around with my database
configuration (persistent connection) But i get errors like "SQL Error
in model xxx:".
I then tried specifying a table prefix (thinking appending the
database would be a fix) but then i just got errors like "No Database
table for model XXX (expected "myPrefix.xxx"), create it first.".

I found in the manual that it's possible to perform custom SQL in the
model (like the plain vanilla sql above), but since my entire app is
split into subsystems on DB level then i would not really gain much
advance in using cakePHP since i wouldn't get all those nifty features
that i am longing :)

And the short version is:
Please help me!
Is it possible to utilize cakePHP for setups with cross database
joins?

Thanks,
Simon


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---