whenever I try to select my database connection like : Database_Connection::instance('mysql1'); I get Fuel\Core\FuelException [ Error ]: Database type not defined in "{$name}" configuration or "{$name}" configuration does not exist
Is there anything wrong with my config file or my database connection usage?
Is you db.php configuration correct? You say you added this to your app/config.php, which is the global database config. If a db.php also exists in your enviroment config folder (where this should be added), that file will overwrite the global one, causing your definitions not to be found.
So, do not use app/config/db.php unless for global settings over all your environments.
Note that you can also select the database a query runs on by passing it's name as a parameter of the execute() method: DB::select()->from('table')->execute('mysql2');
This is optional, and not needed for the default database. For higher-layer functionality, like Model_Crud or Orm models you can configure the database to use in the model, for Auth it's defined in the config file.
I've tried to use the ->execute('mysql2') method but Fuel is still throwing the same exception. I've also tried to use my environment db.php file and paste the connection array: same result
my db config looks correct. To prove it I just have to replace 'mysql1' => array(... by 'default' => array(... and using as natively ->execute(), It goes well and I am able to query the default db.
I also set the active db like this : Database_Connection::instance('mysql1'); Config::set('db.active', 'mysql1'); Then I could dump and saw that the db.active variable was not set to the default anymore!
Finally, I could query my db using: ->execute()
It works fine now! Thanks Harro for your useful advices!