Welcome Guest, Not a member yet? Register   Sign In
multiple database connections postgresql
#1

[eluser]swmcl[/eluser]
Hello,

I also am having difficulties connecting when I move from a 'default' connection group.

I am using 2.0.2 with the latest PHP5 and apache on ubuntu. My previous test run has worked and now I am trying to connect to a new database for another trial.

The controller code is thus:

Code:
// connect to DB and get data
//      $this->load->database();
        $this->load->database($db['app1'],TRUE);
        //Load database utils  , '',TRUE
        $this->load->dbutil();  
        $data['title'] = 'My test Site';
        $data['header'] = 'All of my data';
        $this->load->model('Cdbtestmodel');
        $data['query'] = $this->Cdbtestmodel->get_all_contacts();
        $this->load->view('cdbtestview', $data);

The database config is thus:

Code:
$db['app1']['hostname'] = 'localhost';
$db['app1']['username'] = 'steve';
$db['app1']['password'] = 'steve';
$db['app1']['database'] = 'codeigniter';
$db['app1']['dbdriver'] = 'postgre';
$db['app1']['dbprefix'] = '';
$db['app1']['pconnect'] = TRUE;
$db['app1']['db_debug'] = TRUE;
$db['app1']['cache_on'] = FALSE;
$db['app1']['cachedir'] = '';
$db['app1']['char_set'] = 'utf8';
$db['app1']['dbcollat'] = 'utf8_general_ci';
$db['app1']['swap_pre'] = '';
$db['app1']['autoinit'] = TRUE;
$db['app1']['stricton'] = FALSE;

$db['app2']['hostname'] = 'localhost';
$db['app2']['username'] = 'steve';
$db['app2']['password'] = 'steve';
$db['app2']['database'] = 'crud';
$db['app2']['dbdriver'] = 'postgre';
$db['app2']['dbprefix'] = '';
$db['app2']['pconnect'] = TRUE;
$db['app2']['db_debug'] = TRUE;
$db['app2']['cache_on'] = FALSE;
$db['app2']['cachedir'] = '';
$db['app2']['char_set'] = 'utf8';
$db['app2']['dbcollat'] = 'utf8_general_ci';
$db['app2']['swap_pre'] = '';
$db['app2']['autoinit'] = TRUE;
$db['app2']['stricton'] = FALSE;

It used to work when 'app1' was 'default'. The error is now, "You have specified an invalid database connection group".

Can anyone enlighten me what I need ? I feel as though I've tried a number of options including silly ones.

Rgds,


Messages In This Thread
multiple database connections postgresql - by El Forum - 06-14-2011, 01:20 AM
multiple database connections postgresql - by El Forum - 06-14-2011, 03:38 PM
multiple database connections postgresql - by El Forum - 06-14-2011, 05:41 PM
multiple database connections postgresql - by El Forum - 06-14-2011, 06:18 PM
multiple database connections postgresql - by El Forum - 06-14-2011, 06:38 PM
multiple database connections postgresql - by El Forum - 06-14-2011, 07:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB