CodeIgniter Forums
problem connecting to postgres - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: problem connecting to postgres (/thread-289.html)



problem connecting to postgres - newphpprogrammer - 11-18-2014

Hello!

I am trying connect to postgres, but doesn't work. In my database.php I have something like

$db['default']['hostname'] = '192.168.0.207';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'postgre';
$db['default']['port'] = '5432';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
.........................................

Now, if I try connect using odbc, it works!,

$db['default']['hostname'] = 'DRIVER={PostgreSQL ANSI};SERVER=192.168.0.207;DATABASE=stand';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'odbc';

any idea?

Best Regards
Fernando


RE: problem connecting to postgres - bclinton - 11-18-2014

Do you get an error message?


RE: problem connecting to postgres - tapan.thapa - 11-18-2014

(11-18-2014, 04:00 PM)newphpprogrammer Wrote: Hello!

I am trying connect to postgres, but doesn't work. In my database.php I have something like

$db['default']['hostname'] = '192.168.0.207';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'postgre';
$db['default']['port']     = '5432';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
.........................................

Now, if I try connect using odbc, it works!,

$db['default']['hostname'] = 'DRIVER={PostgreSQL ANSI};SERVER=192.168.0.207;DATABASE=stand';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'odbc';

any idea?

Best Regards
Fernando

Which version of CI you are on?


RE: problem connecting to postgres - blagi - 11-19-2014

(11-18-2014, 04:00 PM)newphpprogrammer Wrote: Hello!

I am trying connect to postgres, but doesn't work. In my database.php I have something like

$db['default']['hostname'] = '192.168.0.207';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'postgre';
$db['default']['port']     = '5432';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
.........................................

Now, if I try connect using odbc, it works!,

$db['default']['hostname'] = 'DRIVER={PostgreSQL ANSI};SERVER=192.168.0.207;DATABASE=stand';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'rontur';
$db['default']['database'] = 'stand';
$db['default']['dbdriver'] = 'odbc';

any idea?

Best Regards
Fernando

Probably you don't have Postgres in PHP (php.ini)?


Best regards

blagi


RE: problem connecting to postgres - newphpprogrammer - 11-19-2014

Oh sorry, You had reason, I forgot change php.ini.
Now works!
Thanks a lots!