• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic - Postgres database connectivity

#1
[eluser]Geek[/eluser]
Hi,

I'm pretty new to CodeIgniter, but I have developed a few working pages in the past. I'm trying to refactor those pages and developing them in a Windows box; but I'm stuck with a Postgres database connectivity issue and I'm getting the following error:

Quote:A Database Error Occurred

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

Filename: C:\Subayogam_v2.0\Codeigniter\system\database\DB_driver.php

Line Number: 124

I know that this error comes up when the database configuration is missing, but I do have a valid DB configuration at C:\Subayogam_v2.0\Codeigniter\application\config\database.php. Given below is the config file data:

Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'subayogam_v2.0';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = TRUE;
/*$db['default']['cachedir'] = '/var/subayogam_2.0/cache';*/
$db['default']['cachedir'] = 'C:\Subayogam_v2.0\Codeigniter\cache';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I double checked the cache folder path and also tried a simple PHP page that connects to the same DB to see if the drivers are working, and I'm able to see results from the database. No useful error messages in Apache error log either.

What could be wrong? Is there any specific log file that can provide me with more information on the error?

Thanks in advance!

#2
[eluser]Geek[/eluser]
I'm planning to work on this over the weekend. Could anyone please help me on this one?

#3
[eluser]NotDior[/eluser]
should driver be set to 'postgres' rather than 'postgre' That's the only thing that looks off to me...I haven't done a windows setup.

Christian

#4
[eluser]Geek[/eluser]
Thank you so much for your reply. The driver should be postgre (I have a working version based on this config and when I try changing it to postgres, it's not able to locate the driver because the driver file is named postgre_driver.php). Any other suggestions?

#5
[eluser]NotDior[/eluser]
Can you connect to your database from the command line using what you are putting into your config file? I'd give that a try if you haven't. Beyond that I'm not going to be much help. I assuming the you have the hooks for postgress in PHP?

#6
[eluser]Geek[/eluser]
I was able to write a simple PHP application and it worked fine. The issue wasn't related to PHP or the driver files.

I created a fresh copy of CodeIgniter and configured everything from scratch to make it work. No change in the config. Only finding this time - <i><u>the database name is case sensitive</i></u> and it took me a few minutes to figure it out.

Thanks!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.