i have an application which need to be connected to 2 different db and in different server. is there any other settings i have to do beside doing it in in database.php? i wrote this in my code to connect to both db:
$provinsi_db = $this->load->database('provinsi', true); //this is from another server
$local = $this->load->database('default', true); //this one is in my localhost
but when i tried to select data from the server db,, nothing happened.. there is no problem selecting data from local db though.. Can anyone help me?
Here is my database.php:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'username_local';
$db['default']['password'] = 'password_local';
$db['default']['database'] = 'db_local';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
$db['provinsi']['hostname'] = 'xxx.xxx.xxx.xxx';
$db['provinsi']['username'] = 'username_foreign';
$db['provinsi']['password'] = 'password_foreign';
$db['provinsi']['database'] = 'db_foreign';
$db['provinsi']['dbdriver'] = 'mysql';
$db['provinsi']['dbprefix'] = '';
$db['provinsi']['pconnect'] = TRUE;
$db['provinsi']['db_debug'] = TRUE;
$db['provinsi']['cache_on'] = FALSE;
$db['provinsi']['cachedir'] = '';
$db['provinsi']['char_set'] = 'utf8';
$db['provinsi']['dbcollat'] = 'utf8_general_ci';
$db['provinsi']['swap_pre'] = '';
$db['provinsi']['autoinit'] = TRUE;
$db['provinsi']['stricton'] = FALSE;
do i have to include port in the server's 'hostname'?
database.php? Can you show us yourdatabase.phpalso?