Re: ECPG could not connect to the database.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Artur Pietruk <arturp(at)plukwa(dot)pdi(dot)net>, Joachim Jaeckel <Joachim(dot)Jaeckel(at)coffeebreak(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: ECPG could not connect to the database.
Date: 2001-01-07 19:52:07
Message-ID: 9826.978897127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> Anyone willing to spend some time digging the hostname problem? That is why
> ecpg programs need to specify a hostname and not an IP number to connect,
> while psql for instance works with both?

I do not see how that can be ecpg's fault --- it just does

this->connection = PQsetdbLogin(NULL, NULL, NULL, NULL, dbname, user, passwd);

which means that any specification of the host must come from the PGHOST
environment variable and will be handled entirely inside libpq.

If ecpg behaves differently from psql (for the same PGHOST setting)
I would imagine that this means different versions of libpq are being
used in the two cases. It might be worth checking shared library
search paths and so forth to try to identify the difference.

Within recent versions of libpq, the given PGHOST string is simply
passed to gethostbyname(). On the machines I've used, gethostbyname()
will accept numeric IP addresses as well as domain names ... but I
suppose there might be C libraries out there that are pickier. What
is the platform showing this problem?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-01-07 20:00:50 Re: Index on Date_Trunc
Previous Message Ian Harding 2001-01-07 19:14:44 Re: Function TOP