Multi Database

Navigation:  Development > MVC (Model View Controller) > Model >

Multi Database

Previous pageReturn to chapter overviewNext page

Model can select connection in model to connect in diffident Database. Each model has a variable $conn to set the database connection name. The connection name is defined in database definition file. See below example:

 

class logModel extends appRain_Base_Model
{
    public $version = "0.1.0";
    public $name = "Log";
    public $db_table = "log";
    public $conn = 'conn2'
}

 

Note: We can not create JOIN between cross database table Join should done among the table in same database.