I'm trying to connect a postgres db but I get this error
my database.php file I have the default connection too add
$db['newdb'] = array(
'dsn' => 'pgsql:host=192.xxx.x.xxx;port=5432;dbname=dbname',
'hostname' => 'localhost',
'username' => 'username',
'password' => 'password',
'database' => 'dbname',
'dbdriver' => 'pgsql',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
here my modal
<?php
class Model extends CI_Model {
private $db_b;
function __construct(){
$this->db_b = $this->load->database('newdb', TRUE);
}
public function getData()
{
$this->db_b->order_by('ad_reference_id', 'asc');
$query = $this->db_b->get('table');
if ($query->num_rows() > 0) {
return $query->result();
} else {
return false;
}
}
}
I got this ERROR An Error Was Encountered
Invalid DB driver
Why is it not working? :(