How to use different connections according to query type

All my reads should go to one DB connection All my writes should go to another connection

How do I accomplish this in Yii, with minimal changing the code of the core library?

Just set in the main.php

'db2'=> array()...

And than in your app you can use Yii::app()->db2

For active record you should override this method

and return Yii::app()->db2

Here’s one Yii extension that may be useful.