PDA

View Full Version : Failed to Connect to Database - tried everything



zed33
10-24-2010, 05:51 PM
I just got back from Holidays and went to play my first session in a couple of weeks. I tried to open HEM but got the message that it failed to connect to the database.

I read the FAQ and tried everything in there. I am running Vista, am not using UAC or Windows Defender, and Firewall is turned off. I updated to the most recent HEM and have rebooted my PC.

The service will not start through Admin Tools; it says it was started but stopped again, possibly because no program is using it.

When i try to reinstall Postgres, it keeps prompting me for the password to the existing database. I have only ever used the default password (i thought it was postgrespass (?) but when i enter that it says incorrect password.

Please help, I really don't want to lose my existing database!

loustic
10-24-2010, 07:47 PM
Hi Zed,

Open a prompt window (cmd) and type this:

net user postgres /delete

It should delete the user postgres

Then, you reinstall PostgreSQL again and when asked for the password, you put a new one.

zed33
10-24-2010, 07:51 PM
Thanks, will that affect my current database?

edit: oh i also subsequently uninstalled HEM and then reinstalled the whole package including postgres, which worked fine, but it still failed to connect at the end.

edit 2: ok i tried that and still having same problem. i also realised i dont really mind losing the database because i have all the HHs saved and can just reimport them. so once again i uninstalled everything and still having same problem. i also tried installing postgres 9 and again got prompted for the password for the databse and service account, which i am sure is postgrespass, but it doesnt accept it and so wont install.

netsrak
10-25-2010, 03:38 AM
1. Reboot your computer
2. If that doesn't help look for the hidden system file postmaster.pid in the postgresql data folder, delete it and reboot your computer again.
3. Check the postgresql service in the windows services (control panel->administration). Sometimes it helps to change the Logon As.. to "local system account"
4. Check our FAQ:
FAQ - Hold'em Manager Poker Tracking Software :: Can't Connect / Failed to Start PostgreSQL (http://faq.holdemmanager.com/questions/91/Can%27t+Connect+%7B47%7D+Failed+to+Start+PostgreSQ L+)

loustic
10-25-2010, 12:59 PM
You should:

- Uninstall PostgreSQL
- Delete user postgres like explained
- Reinstall PostgreSQL 8.4 (not from the HEM package, but from PostgreSQL website: http://www.enterprisedb.com/join-dev-community.do?fileid=1528

Then, during installation of PostgreSQL, you'll be prompted for a password, and you choose the password that you want.

zed33
10-25-2010, 04:46 PM
Okay, I managed to delete the user postgres and get it all reinstalled - it finally connected when I ran it as a Local Service. Then I created a new database and started reimporting my saved HHs. There were about 5000 tournaments, 600k hands. it got slower and slower as it kept importing, and I stopped the process after about 14 hours, when it was 2/3 of the way through. I decided to try and do all the maintenance on the database, which might help it accept the rest of the HHs faster.

My whole system ground to a halt. I rebooted using the reset button and even once it rebooted it was freezing up for about 10 minutes until eventually it came good. Then I ran PGAdmin and started a full vacuum. It went through the vacuum for about 15 minutes, then it stopped and said it had lost connection to the database because it had timed out.

I went to start HEM and once again it said a timeout had occurred and I needed to increase the timeout value depending on how it had timed out. I then went to Services in Admin Tools and tried to start the service - it said it could not start because the service did not respond in a timely fashion.

This is getting very frustrating, how can I fix this once and for all?

loustic
10-25-2010, 05:55 PM
What's your configuration ? (CPU / RAM / OS)

600k hands is big import, and you should make multiple imports instead of 1 big.

Also, I wouldn't be surprised that your problem occurs because of the log files.

By default, PostgreSQL logs all changes, and you probably have huge log files.

First of all, delete them:

The logs are located here:
C:\Program Files\PostgreSQL\8.4\data\pg_log

Delete everything here.

Then, in that folder:
C:\Program Files\PostgreSQL\8.4\data
Change the line:
logging_collector = on

by:
logging_collector = off

When this is done, make your imports, but definitely cut this big import into several medium ones.

And when import is done, close HEM, launch PGAdmin and make a vacuum / analyse / full.

Of course, the database you've created and that you've killed during import must be deleted, and you must create a new one to make all this process.

zed33
10-25-2010, 06:24 PM
I am running Vista 64bit, CPU is an i7 920, 6GB ram.

Alright thanks, as soon as I'm finished playing I will try that, in the meantime I will uninstall postgres again and resintall, but for now when I try to start HEM I am getting the same old error that it can't connect to the database. Hopefully a reboot and reinstall will fix that.

Should I keep it running on local machine or try to get it recreate the postgres user?

loustic
10-26-2010, 12:55 AM
Well, when postgres service stops, like any service one of the 1st thing you should try is to manually start it (windows key, type services.msc and it will open the services window, go to postgresql-8.4 and look if the service is started. If not, try to manually start it).

If it doesn't start, launch event viewer (windows key, type eventvwr.msc). Check in the application window, you should see some events logged for PostgreSQL.
Check what is the problem.

If you can't manage to find the problem, of course make a first reboot before planning to uninstall / reinstall anything, and most of the time your PostgreSQL engine should be working again :)

If you need to uninstall / reinstall PostgreSQL, you don't have to delete the user postgres, as this time you probably know the password :)


Btw: Vista 64bits... definitely not the best pick ;)

And on Vista, you should do the following too:

Right click on these 3 .exe files in the main Holdem Manager folder:
holdemmanager.exe, dbcontrolpanel.exe, hmhud.exe and select "Run as admin" from the popup menu under compatibilty.