0

i am getting the following error :

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 346

my database.php is :

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'usertest';
$db['default']['password'] = '';
$db['default']['database'] = 'usertest';
$db['default']['port']     = '5433';
$db['default']['dbdriver'] = 'postgre';
$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;

What is the possible solution. I do not want to $db['default']['db_debug'] = FALSE; as even after doing this i am still not able to connect to db.

EDIT : Changed the port to 5432. still it doesnt work

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
Bhumi Singhal
  • 8,063
  • 10
  • 50
  • 76

4 Answers4

0

Set Set $db['default']['pconnect'] = FALSE; and check once again.

EKL
  • 143
  • 3
  • 13
0

Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might require a full DSN string to be provided. If that is the case, you should use the ‘dsn’ configuration setting, as if you’re using the driver’s underlying native PHP extension, like this:

$db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';

from official documentation of codeigniter

runningmark
  • 738
  • 4
  • 13
  • 32
0

Try:

$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
topimiring
  • 140
  • 1
  • 8
-1

Check your db driver name. I am pretty sure it is "postgres" and not "postgre."

Chris Travers
  • 25,424
  • 6
  • 65
  • 182