PostgreSQL stopped working

    • Paznecht
      Paznecht
      Bronze
      Joined: 05.01.2008 Posts: 78
      Hi guys,

      i have apache2triad installed on my computer, so I didn't had to install postgre when installing PT3...everything was ok, database worked well for let's say a month, but then suddenly when i turned on PT it said it can't connect to the database...when I start postgre from apache CP, it says
      Postgresql has been started

      All done


      but in fact it's still not working... so I tried to run a test database...

      Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? in C:\apache2triad\htdocs\apache2triadcp\test.pgsql.php on line 21 Could not connect to template1 on localhost with root@127.0.0.1


      the server is running on localhost and port is set to 5432...

      then I tried to connect to the database via PgAdmin, but it told me that server is not listening

      so, the best way would be naturally to fix it, but if it doesn't work or whatever, can I use the content of apache2triad\pgsql\data\base directory, copy it and then use it in re-installed software?

      PS: all other apache services are running properly

      thanks for responses...
  • 4 replies
    • hepcat
      hepcat
      Bronze
      Joined: 21.03.2008 Posts: 5,361
      I got the same problem it worked yesterday but not today could not connect to database on 127.0 bl bla bla.

      But I have elephant but it's still postgree database.

      The same then I started pgadmin the server doesn't listen
    • radpok
      radpok
      Bronze
      Joined: 07.02.2007 Posts: 35
      Hi I had the same problem and found a solution at Holdemmanager site:

      "Hi, Microsoft released a patch last night that has caused some issues with the postgresql service for some people on Vista. The following steps seem to get around this problem:

      1: Go to "C:\Windows\system32\drivers\etc" and open the "hosts" file with notepad

      It might look something like this:
      **************************************************
      # Copyright (c) 1993-2006 Microsoft Corp.
      #
      # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
      #
      # This file contains the mappings of IP addresses to host names. Each
      # entry should be kept on an individual line. The IP address should
      # be placed in the first column followed by the corresponding host name.
      # The IP address and the host name should be separated by at least one
      # space.
      #
      # Additionally, comments (such as these) may be inserted on individual
      # lines or following the machine name denoted by a '#' symbol.
      #
      # For example:
      #
      # 102.54.94.97 rhino.acme.com # source server
      # 38.25.63.10 x.acme.com # x client host

      ::1 localhost
      ************************************************** ****

      2: Enter "127.0.0.1 localhost" (without the quotes) at the bottom of the file
      4: Save the file
      5: Restart PostgreSQL service by clicking on Start Menu - Programs - Postgresql - Start Service"

      It's working for me, it took me like 4h to solve the problem. It might help
      Good luck
    • Paznecht
      Paznecht
      Bronze
      Joined: 05.01.2008 Posts: 78
      thanks, but my case is different...first of all i am not using Vista, i have XP SP2...
      second is that i didn't update anything...it just stopped working when i turned it on another day:/
      although i don't have Vista i checked the hosts file and the localhost address is correct...

      so if there's any other known solution, please come with your suggestions
    • Paznecht
      Paznecht
      Bronze
      Joined: 05.01.2008 Posts: 78
      So I've reinstalled apache and re-imported all hands, but then i found this and it worked with the same kind of issue that i had, so try this before reinstalling

      1. Go to Start -> Control Panel -> System -> Computer Name [tab] and get the 'Full computer name:' name. I am going to refer to this value below as FULLCOMPNAME which you will need to change in point 4.
      2. Go to Start -> Run...
      3. Type 'C:' and click enter. If you have installed A2T on a different drive enter that intead of 'C:' example 'D:'
      4. Type: runas /env /user:FULLCOMPNAME\apache2triad "initdb -U root -D C:/apache2triad/pgsql/data/" and press enter. Remember to change FULLCOMPNAME with your 'Full computer name:' which you can get in point 1. Also change C: if you have A2T installed on a different drive.
      5. You will then be promoted for a password, I entered my root password I entered at the time of installing A2T. Press Enter.
      6.This should trigger another command window to open and will run through and install pgsql.


      hope it helps someone