Codeigniter mysql db connection with Amazon RDS failing Codeigniter mysql db connection with Amazon RDS failing codeigniter codeigniter

Codeigniter mysql db connection with Amazon RDS failing


As you're using more than one connection, you'll want to pass in a second parameter of 'TRUE' to return the database object.

$this->db = $this->load->database('aws', TRUE);

If you don't pass this, then the database object is not returned and therefor you can't call any of the functions (such as get(), query() etc).

You can read more about multiple connections here:https://ellislab.com/codeigniter/user-guide/database/connecting.html

Hope this helps - let me know how you get on!

Note: It may be worth mentioning it may make things easier if instead of assigning the database to $this->db, you chose another name such as $this->aws_db as then you're not overwriting the $this->db object for your default database. Probably not a big issue, but may make it easier to troubleshoot as your project grows.