cannot connect to database through ECPG but can through psql

Started by Seann Reedalmost 11 years ago3 messagesgeneral
Jump to latest
#1Seann Reed
reedseannm@gmail.com

I'm a relative newbie to Postgres but I've asked a few colleagues about
this problem without a solution, so I'm hoping someone on the list serve
can help.

The problem arose when I move to an upgraded operating system, an upgraded
version of Postgres, and when I dump a database out of the old machine and
restore it on a new machine.

Old: RedHat 5.9, Postgres 8.1.23
New: RedHat 6.6, Postgres 9.2

Everything worked fine with the old setup. With the new setup, I can
access my database through psql command-line. However, I have a compiled
program called 'Shefdecode' that makes queries to the database through ECPG
and this program cannot access the database. I get errors:

"Postgres error -220" and
"SQL STATE = 08003" (User manual says this means "The program tried to
access a connection that does not exist.")

Although I don't have the source for the Shefdecode program, I know it uses
the environment variables PGUSER and PGHOST and also gets passed the
database name. I've checked to make sure these are correct.

What else should I look for to try to determine the cause of this error?

Any ideas would be greatly appreciated.

Seann

#2Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Seann Reed (#1)
Re: cannot connect to database through ECPG but can through psql

Seann Reed <reedseannm@gmail.com> wrote:

Everything worked fine with the old setup.� With the new setup, I can access my
database through psql command-line.� However, I have a compiled program called
'Shefdecode' that makes queries to the database through ECPG and this program
cannot access the database.� I get errors:

My guess: psql connects via unix socket, that's works. The programm
tries to connect via tcp/ip - don't work.

Check if listen_adresses in your postgresql.conf is enabled.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889�

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Seann Reed (#1)
Re: cannot connect to database through ECPG but can through psql

Seann Reed <reedseannm@gmail.com> writes:

I'm a relative newbie to Postgres but I've asked a few colleagues about
this problem without a solution, so I'm hoping someone on the list serve
can help.

The problem arose when I move to an upgraded operating system, an upgraded
version of Postgres, and when I dump a database out of the old machine and
restore it on a new machine.

Old: RedHat 5.9, Postgres 8.1.23
New: RedHat 6.6, Postgres 9.2

Everything worked fine with the old setup. With the new setup, I can
access my database through psql command-line. However, I have a compiled
program called 'Shefdecode' that makes queries to the database through ECPG
and this program cannot access the database. I get errors:

"Postgres error -220" and
"SQL STATE = 08003" (User manual says this means "The program tried to
access a connection that does not exist.")

Although I don't have the source for the Shefdecode program, I know it uses
the environment variables PGUSER and PGHOST and also gets passed the
database name. I've checked to make sure these are correct.

What else should I look for to try to determine the cause of this error?

Postmaster's log might offer some insight, especially if you turn on
log_connections.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general