I am trying to connect from multiples databases from a loop, but seens CakePHP can\'t change database
, only others infos (like user/pass/host).
app/
Try not to drop config, just alter the things you need.
For this task I successfully use
$dataSource = ConnectionManager::getDataSource('company_data');
$dataSource->config['schema'] = 'company_'.$id;
I don't know if database switching and mysql as engine is good pair. I use postgresql schemas for this purpose.
You can use the model method setSource() to change the table or setDataSource() to change the db config.