Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running PostgreSQL in Windows. I have a vanilla installation with a single admin Windows user account, which I've used to install PostgreSQL and pgAdmin III. Using pgAdmin III I created a database owned by the postgresql account.

I have an external application which needs to access the database. I have provided that application with the postgresql username and password.

If I do not connect to the database via pgAdmin III (a red X appears on the database), the external application cannot connect to the database. As soon as I do connect to the database via pgAdmin III, the external application can connect. This is a problem because both programs (PostgreSQL and the application) are running as services and need to be able to start up and connect automatically when the server is restarted (both services do start correctly when the server is restarted).

In desperation I even saved the password when connecting to the database via pgAdmin III, hoping that the connection would persist between reboots, but it didn't.

How can I set the database up to be permanently available for logging in with the correct username and password? Preferably without saving the password in plaintext.

share|improve this question

Your problem sounds very strange.

At first check if your PostgreSQL is running. It should be listening on one port, usually port 5432. For this you can use netstat, TCPView, ProcessExplorer.

Then try using psql (it should be in PostgreSQL bin directory) to list available databases with -l switch:

[test:~]# psql -l -U postgres
                List of databases
                Name                |  Owner   | Encoding
 postgres                           | postgres | LATIN2
 template0                          | postgres | LATIN2
 template1                          | postgres | LATIN2
 test                               | postgres | LATIN2

(use psql --help to see various options)

Then you can connect to your database with:

psql -U [user] [database]

Try this to see if you can connect to this database. Maybe your PGAdmin starts PostgreSQL service?

I think that if your external application has problems with connecting to database then you must contact with its creators. Maybe they save password in some config file or registry.

share|improve this answer
It is a very strange problem. Thanks for the detailed advice, I'll give it a try. – d3vid Oct 10 '11 at 9:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.