I have a problem in connecting to the database in remote server. The code is /config/database.php is as follows:
$active_group = 'default';
$active_group = 'main';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'local_server';
$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['main']['hostname']='xxx.xx.xx.xx';
$db['main']['username']='user';
$db['main']['password'] ='pwd';
$db['main']['database'] = 'database1';
$db['main']['dbdriver'] = 'mysql';
$db['main']['dbprefix'] = '';
$db['main']['pconnect'] = TRUE;
$db['main']['db_debug'] = TRUE;
$db['main']['cache_on'] = FALSE;
$db['main']['cachedir'] = '';
$db['main']['char_set'] = 'utf8';
$db['main']['dbcollat'] = 'utf8_general_ci';
$db['main']['swap_pre'] = '';
$db['main']['autoinit'] = TRUE;
$db['main']['stricton'] = FALSE;
In /system/database/DB_driver.php. I have changed the pconnect to true var $pconnect= TRUE;
From the controller say student i try to connect the remote server database say "database1" as per the below code:
public function check_main()
{
$this->load->database('database1','TRUE');
}
I get the following error:
Unable to connect to your database server using the provided settings.
Filename: C:\xampp\htdocs\student_attendance\system\database\DB_driver.php
Line Number: 124
In the remote server, % wildcard is given for "Remote Database Access Hosts"