动态告知CI必须使用哪个数据库

I've developped an app using CI 3.1.0, and I'd like to make it more portable, so I've developped an Install model, called by an Install controller. Basically, when it's called, it checks if there is a DB (with the credentials provided in database.php) with a specific name. If there is not such a DB, it creates it then creates the tables inside it.

I've created a new group named 'newbase' where the credentials are dynamically added during the install process; for instance, to give the database name, I have the following piece of code :

    $this->db->database = $database;

My problem is when I want to create the tables with the Database Forge create_table() method : I get an error message telling me that no DB has been selected (err 1046).

Just before creating the tables, I load the proper database and I checked if it's in use :

$this->load->database('newbase', TRUE);
echo "<BR>the active database is :".$this->db->database;

However, I still get this 1046 error. If I'm not mistaken, loading a database is equivalent to the keyword USE, so why my solution soesn't work ?

Thanks