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.
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:(use
psql --help
to see various options)Then you can connect to your database with:
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.