CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config file is located at application/config/database.php. You can also set database connection values for specific environments by placing database.php in the respective environment config folder.
The config settings are stored in a multi-dimensional array with this prototype:
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',