You can create connection config dynamically with
ConnectionManager::create($name, $config) call. $name is name of your
new config (used in $this->useDbConfig) and $config is array of same
structure as in DATABASE_CONFIG class.

First you create new connection config, then in target model you must
set $useDbConfig to new config name and $useTable to target table (or
leave as it is if tables names do not change) and switch model to new
connection by $this->setSource($this->useTable) call.

Be sure to create config with new name - not any you already defined
in DATABASE_CONFIG or dynamically before.

On Jun 7, 8:09 pm, rafpv <[email protected]> wrote:
> Hi all,
>
> I have to create an import tool, in my CakePHP application.
>
> The user must inform, the database (mysql, sqlserver or access), login and
> password.
>
> With this, I will connect to database, and read the data that I want.
>
> I have to modifiy the database.php file?
>
> I can use ConnectionManager to do this?
>
> What is the best way to do this in cakePHP?
>
> Thanks!
>
> --
> View this message in 
> context:http://cakephp.1045679.n5.nabble.com/Connect-to-multiple-databases-dy...
> Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to