Re: ECPG could not connect to the database. - Mailing list pgsql-general

From Tom Lane
Subject Re: ECPG could not connect to the database.
Date
Msg-id 9826.978897127@sss.pgh.pa.us
Whole thread Raw
In response to Re: ECPG could not connect to the database.  (Michael Meskes <meskes@postgresql.org>)
Responses Re: ECPG could not connect to the database.  (Michael Meskes <meskes@postgresql.org>)
List pgsql-general
Michael Meskes <meskes@postgresql.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Outer Joins
Next
From: Tom Lane
Date:
Subject: Re: Index on Date_Trunc