I need to dynamically change between several (large amount of) db connections.
From what i can see in the documentation, i need to override the getDbConnection() function of each model but the main problem here is that a model doesn't exclusively belong to a db connection, i.e. a model represents a table that exists in several (if not all) databases.
I’m not sure this would solve your problem, but give this a thought.
Extend CActiveRecord::model() so it takes a parameter indicating a db connection. Before returning parent::model() implementation, it sets the corresponding connection to a protected property.
Make sure CActiveRecord::getDbConnection() will find it.