Обсуждение: Re. conection error

Поиск
Список
Период
Сортировка

Re. conection error

От
Russ McBride
Дата:
Thanks Nick,

The first line in my pg_hba.conf file is:

local      all                                trust

which should be all that is needed to allow a jdbc connection over ip
from 'postgres' on a local machine (and it shouldn't be a problem
that the connection program sends the password as well, I assume).
Is there some other line I should be adding to make this connection
possible.  It seems like it should just work, but I'm probably
missing something.


Best,

Russ


Nick wrote:
----------------------------------------

Russ-

JDBC connects using TCP/IP and this indicates that your host machine doesn't
have a line in /etc/postgresql/pg_hba.conf allowing the requested
connection. This is necessary even if you are connecting to localhost.
Here's what our pg_hba.conf looks like:

local        all                                           peer sameuser
host         all         127.0.0.1     255.0.0.0           ident sameuser
host         all         xxx.xxx.xxx.xxx  255.255.255.255  trust

The first lines allow a connection on the same machine.

The last line allows a connection from the IP address xxx.xxx.xxx.xxx
without any authentication. For details, search for pg_hba in the
interactive docs.

-Nick

Re: Re. conection error

От
"Nick Fankhauser"
Дата:
Hi Russ-

> The first line in my pg_hba.conf file is:
>
> local      all                                trust

I don't think this line authorizes TCP/IP socket connections, but rather,
only Unix sockets. Since JDBC uses TCP/IP even if you are on the same
machine, you'll need a similar auth record starting with "host" for
127.0.0.1 (locahost) like the one below, or using trust as the method if you
prefer.

> host         all         127.0.0.1     255.0.0.0           ident sameuser

check out this page for a better explanation:

http://www.postgresql.org/idocs/index.php?client-authentication.html#PG-HBA.
CONF


Regards,

-Nick