Обсуждение: Cannot connect to Database

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

Cannot connect to Database

От
bernd@kalwar.net
Дата:
Hi,

everytime I try to connect to my Database with a Java-Applikation, I
recieve only the following Exception:


org.postgresql.util.PSQLException: A connection error has occurred:
org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag für
Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus

I get the same error-message with other applications, e.g. pgaccess, too.

My pg_hba.conf looks like:

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
METHOD


host    all         all         127.0.0.1         255.255.255.255   trust


The database and the applications are on the same host.

What could be the problem.

thx (and soory for my english),
Bernd



Re: Cannot connect to Database

От
Lonni J Friedman
Дата:
On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net <bernd@kalwar.net> wrote:
> Hi,
>
> everytime I try to connect to my Database with a Java-Applikation, I
> recieve only the following Exception:
>
> org.postgresql.util.PSQLException: A connection error has occurred:
> org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag für
> Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
>
> I get the same error-message with other applications, e.g. pgaccess, too.
>
> My pg_hba.conf looks like:
>
> # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> METHOD
>
> host    all         all         127.0.0.1         255.255.255.255   trust
>
> The database and the applications are on the same host.
>
> What could be the problem.

Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
connect via localhost (127.0.0.1) or some other route?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama@gmail.com
LlamaLand                       http://netllama.linux-sxs.org

Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
> Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> connect via localhost (127.0.0.1) or some other route?

I start the Server with the -i option, so TCP/IP is activated, isn't it?
I want to connect by localhost to my database.

thx,

Bernd

 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 18:52
Von: Lonni J Friedman <netllama@gmail.com>
An: "bernd@kalwar.net" <bernd@kalwar.net>
Betreff: Re: [GENERAL] Cannot connect to Database

> On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net <bernd@kalwar.net>
wrote:
> > Hi,
> >
> > everytime I try to connect to my Database with a Java-Applikation, I
> > recieve only the following Exception:
> >
> > org.postgresql.util.PSQLException: A connection error has occurred:
> > org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag
für
> > Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
> >
> > I get the same error-message with other applications, e.g. pgaccess,
too.
> >
> > My pg_hba.conf looks like:
> >
> > # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > METHOD
> >
> > host    all         all         127.0.0.1         255.255.255.255
trust
> >
> > The database and the applications are on the same host.
> >
> > What could be the problem.
>
> Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> connect via localhost (127.0.0.1) or some other route?
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> L. Friedman                                    netllama@gmail.com
> LlamaLand                       http://netllama.linux-sxs.org
>


Re: Cannot connect to Database

От
"Joshua D. Drake"
Дата:
bernd@kalwar.net wrote:
>>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
>>connect via localhost (127.0.0.1) or some other route?
>
>
> I start the Server with the -i option, so TCP/IP is activated, isn't it?
> I want to connect by localhost to my database.

 From the localhost can you:

psql -h 127.0.0.1 -U postgres template1

?

Sincerely,

Joshua D. Drake


>
> thx,
>
> Bernd
>
>  --- Ursprüngliche Nachricht ---
> Datum: 08.02.2005 18:52
> Von: Lonni J Friedman <netllama@gmail.com>
> An: "bernd@kalwar.net" <bernd@kalwar.net>
> Betreff: Re: [GENERAL] Cannot connect to Database
>
>
>>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net <bernd@kalwar.net>
>
> wrote:
>
>>>Hi,
>>>
>>>everytime I try to connect to my Database with a Java-Applikation, I
>>>recieve only the following Exception:
>>>
>>>org.postgresql.util.PSQLException: A connection error has occurred:
>>>org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag
>
> für
>
>>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
>>>
>>>I get the same error-message with other applications, e.g. pgaccess,
>
> too.
>
>>>My pg_hba.conf looks like:
>>>
>>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
>>>METHOD
>>>
>>>host    all         all         127.0.0.1         255.255.255.255
>
> trust
>
>>>The database and the applications are on the same host.
>>>
>>>What could be the problem.
>>
>>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
>>connect via localhost (127.0.0.1) or some other route?
>>
>>--
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>L. Friedman                                    netllama@gmail.com
>>LlamaLand                       http://netllama.linux-sxs.org
>>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq


--
Command Prompt, Inc., your source for PostgreSQL replication,
professional support, programming, managed services, shared
and dedicated hosting. Home of the Open Source Projects plPHP,
plPerlNG, pgManage,  and pgPHPtoolkit.
Contact us now at: +1-503-667-4564 - http://www.commandprompt.com


Вложения

Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
I recvive still the same error-message.

thx,
Bernd

 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 19:14
Von: "Joshua D. Drake" <jd@commandprompt.com>
An: bernd@kalwar.net
Betreff: Re: [GENERAL] Cannot connect to Database

> bernd@kalwar.net wrote:
> >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> >>connect via localhost (127.0.0.1) or some other route?
> >
> >
> > I start the Server with the -i option, so TCP/IP is activated, isn't
it?
> > I want to connect by localhost to my database.
>
>  From the localhost can you:
>
> psql -h 127.0.0.1 -U postgres template1
>
> ?
>
> Sincerely,
>
> Joshua D. Drake
>
>
> >
> > thx,
> >
> > Bernd
> >
> >  --- Ursprüngliche Nachricht ---
> > Datum: 08.02.2005 18:52
> > Von: Lonni J Friedman <netllama@gmail.com>
> > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > Betreff: Re: [GENERAL] Cannot connect to Database
> >
> >
> >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
<bernd@kalwar.net>
> >
> > wrote:
> >
> >>>Hi,
> >>>
> >>>everytime I try to connect to my Database with a Java-Applikation, I
> >>>recieve only the following Exception:
> >>>
> >>>org.postgresql.util.PSQLException: A connection error has occurred:
> >>>org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag
> >
> > für
> >
> >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
> >>>
> >>>I get the same error-message with other applications, e.g. pgaccess,
> >
> > too.
> >
> >>>My pg_hba.conf looks like:
> >>>
> >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> >>>METHOD
> >>>
> >>>host    all         all         127.0.0.1         255.255.255.255
> >
> > trust
> >
> >>>The database and the applications are on the same host.
> >>>
> >>>What could be the problem.
> >>
> >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> >>connect via localhost (127.0.0.1) or some other route?
> >>
> >>--
> >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>L. Friedman                                    netllama@gmail.com
> >>LlamaLand                       http://netllama.linux-sxs.org
> >>
> >
> >
> >
> > ---------------------------(end of
broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> >                http://www.postgresql.org/docs/faq
>
>
> --
> Command Prompt, Inc., your source for PostgreSQL replication,
> professional support, programming, managed services, shared
> and dedicated hosting. Home of the Open Source Projects plPHP,
> plPerlNG, pgManage,  and pgPHPtoolkit.
> Contact us now at: +1-503-667-4564 - http://www.commandprompt.com
>
>
>


Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
I still recive the same error-message

thx,
Bernd

 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 19:13
Von: javier wilson <javier.wilson@gmail.com>
An: "bernd@kalwar.net" <bernd@kalwar.net>
Betreff: Re: [GENERAL] Cannot connect to Database

> have you tried connecting to it with other tool, like "psql -h
> localhost -U postgresql test" ?
> in my opinion the message is clear, something must be wrong with
pg_hba.conf
> have reloaded postgresql after updating this file?
>
> javier
>
> On Tue, 08 Feb 2005 19:01:28 +0100, bernd@kalwar.net <bernd@kalwar.net>
wrote:
> > > Do you have TCP/IP activated in postgresql.conf ?  Are you trying
to
> > > connect via localhost (127.0.0.1) or some other route?
> >
> > I start the Server with the -i option, so TCP/IP is activated, isn't
it?
> > I want to connect by localhost to my database.
> >
> > thx,
> >
> > Bernd
> >
> >  --- Ursprüngliche Nachricht ---
> > Datum: 08.02.2005 18:52
> > Von: Lonni J Friedman <netllama@gmail.com>
> > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > Betreff: Re: [GENERAL] Cannot connect to Database
> >
> > > On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
<bernd@kalwar.net>
> > wrote:
> > > > Hi,
> > > >
> > > > everytime I try to connect to my Database with a Java-Applikation,
I
> > > > recieve only the following Exception:
> > > >
> > > > org.postgresql.util.PSQLException: A connection error has
occurred:
> > > > org.postgresql.util.PSQLException: FATAL: kein
pg_hba.conf-Eintrag
> > für
> > > > Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
> > > >
> > > > I get the same error-message with other applications, e.g.
pgaccess,
> > too.
> > > >
> > > > My pg_hba.conf looks like:
> > > >
> > > > # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > METHOD
> > > >
> > > > host    all         all         127.0.0.1         255.255.255.255
> > trust
> > > >
> > > > The database and the applications are on the same host.
> > > >
> > > > What could be the problem.
> > >
> > > Do you have TCP/IP activated in postgresql.conf ?  Are you trying
to
> > > connect via localhost (127.0.0.1) or some other route?
> > >
> > > --
> > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > L. Friedman                                    netllama@gmail.com
> > > LlamaLand                       http://netllama.linux-sxs.org
> > >
> >
> > ---------------------------(end of
broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> >                http://www.postgresql.org/docs/faq
> >
>


Re: Cannot connect to Database

От
Scott Marlowe
Дата:
Did you restart Postgresql after editing your pg_hba.conf file?

On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> I recvive still the same error-message.
>
> thx,
> Bernd
>
>  --- Ursprüngliche Nachricht ---
> Datum: 08.02.2005 19:14
> Von: "Joshua D. Drake" <jd@commandprompt.com>
> An: bernd@kalwar.net
> Betreff: Re: [GENERAL] Cannot connect to Database
>
> > bernd@kalwar.net wrote:
> > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> > >>connect via localhost (127.0.0.1) or some other route?
> > >
> > >
> > > I start the Server with the -i option, so TCP/IP is activated, isn't
> it?
> > > I want to connect by localhost to my database.
> >
> >  From the localhost can you:
> >
> > psql -h 127.0.0.1 -U postgres template1
> >
> > ?
> >
> > Sincerely,
> >
> > Joshua D. Drake
> >
> >
> > >
> > > thx,
> > >
> > > Bernd
> > >
> > >  --- Ursprüngliche Nachricht ---
> > > Datum: 08.02.2005 18:52
> > > Von: Lonni J Friedman <netllama@gmail.com>
> > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > Betreff: Re: [GENERAL] Cannot connect to Database
> > >
> > >
> > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> <bernd@kalwar.net>
> > >
> > > wrote:
> > >
> > >>>Hi,
> > >>>
> > >>>everytime I try to connect to my Database with a Java-Applikation, I
> > >>>recieve only the following Exception:
> > >>>
> > >>>org.postgresql.util.PSQLException: A connection error has occurred:
> > >>>org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag
> > >
> > > für
> > >
> > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«, SSL aus
> > >>>
> > >>>I get the same error-message with other applications, e.g. pgaccess,
> > >
> > > too.
> > >
> > >>>My pg_hba.conf looks like:
> > >>>
> > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > >>>METHOD
> > >>>
> > >>>host    all         all         127.0.0.1         255.255.255.255
> > >
> > > trust
> > >
> > >>>The database and the applications are on the same host.
> > >>>
> > >>>What could be the problem.
> > >>
> > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying to
> > >>connect via localhost (127.0.0.1) or some other route?
> > >>
> > >>--
> > >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >>L. Friedman                                    netllama@gmail.com
> > >>LlamaLand                       http://netllama.linux-sxs.org
> > >>
> > >
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 5: Have you checked our extensive FAQ?
> > >
> > >                http://www.postgresql.org/docs/faq
> >
> >
> > --
> > Command Prompt, Inc., your source for PostgreSQL replication,
> > professional support, programming, managed services, shared
> > and dedicated hosting. Home of the Open Source Projects plPHP,
> > plPerlNG, pgManage,  and pgPHPtoolkit.
> > Contact us now at: +1-503-667-4564 - http://www.commandprompt.com
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
> Did you restart Postgresql after editing your pg_hba.conf file?

Yes, I did.

thx,
Bernd

 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 19:31
Von: Scott Marlowe <smarlowe@g2switchworks.com>
An: bernd@kalwar.net
Betreff: Re: [GENERAL] Cannot connect to Database

> Did you restart Postgresql after editing your pg_hba.conf file?
>
> On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> > I recvive still the same error-message.
> >
> > thx,
> > Bernd
> >
> >  --- Ursprüngliche Nachricht ---
> > Datum: 08.02.2005 19:14
> > Von: "Joshua D. Drake" <jd@commandprompt.com>
> > An: bernd@kalwar.net
> > Betreff: Re: [GENERAL] Cannot connect to Database
> >
> > > bernd@kalwar.net wrote:
> > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
to
> > > >>connect via localhost (127.0.0.1) or some other route?
> > > >
> > > >

> > > > I start the Server with the -i option, so TCP/IP is activated,
isn't
> > it?
> > > > I want to connect by localhost to my database.
> > >
> > >  From the localhost can you:
> > >
> > > psql -h 127.0.0.1 -U postgres template1
> > >
> > > ?
> > >
> > > Sincerely,
> > >
> > > Joshua D. Drake
> > >
> > >
> > > >
> > > > thx,
> > > >
> > > > Bernd
> > > >
> > > >  --- Ursprüngliche Nachricht ---
> > > > Datum: 08.02.2005 18:52
> > > > Von: Lonni J Friedman <netllama@gmail.com>
> > > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > >
> > > >
> > > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> > <bernd@kalwar.net>
> > > >
> > > > wrote:
> > > >
> > > >>>Hi,
> > > >>>
> > > >>>everytime I try to connect to my Database with a
Java-Applikation, I
> > > >>>recieve only the following Exception:
> > > >>>
> > > >>>org.postgresql.util.PSQLException: A connection error has
occurred:
> > > >>>org.postgresql.util.PSQLException: FATAL: kein
pg_hba.conf-Eintrag
> > > >
> > > > für
> > > >
> > > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«,
SSL aus
> > > >>>
> > > >>>I get the same error-message with other applications, e.g.
pgaccess,
> > > >
> > > > too.
> > > >
> > > >>>My pg_hba.conf looks like:
> > > >>>
> > > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > >>>METHOD
> > > >>>
> > > >>>host    all         all         127.0.0.1
255.255.255.255
> > > >
> > > > trust
> > > >
> > > >>>The database and the applications are on the same host.
> > > >>>
> > > >>>What could be the problem.
> > > >>
> > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
to
> > > >>connect via localhost (127.0.0.1) or some other route?
> > > >>
> > > >>--
> > >
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >>L. Friedman                                    netllama@gmail.com
> > > >>LlamaLand                       http://netllama.linux-sxs.org
> > > >>
> > > >
> > > >
> > > >
> > > > ---------------------------(end of
> > broadcast)---------------------------
> > > > TIP 5: Have you checked our extensive FAQ?
> > > >
> > > >                http://www.postgresql.org/docs/faq
> > >
> > >
> > > --
> > > Command Prompt, Inc., your source for PostgreSQL replication,
> > > professional support, programming, managed services, shared
> > > and dedicated hosting. Home of the Open Source Projects plPHP,
> > > plPerlNG, pgManage,  and pgPHPtoolkit.
> > > Contact us now at: +1-503-667-4564 - http://www.commandprompt.com
> > >
> > >
> > >
> >
> >
> > ---------------------------(end of
broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
>


Re: Cannot connect to Database

От
Lonni J Friedman
Дата:
Well, its obviosly not listening on localhost.  Are you firewalling
anywhere?  Which OS is this?  Which version of postgresql?

If this is Linux, what do you get from running 'netstat -an | grep 5432' ?

On Tue, 08 Feb 2005 19:44:26 +0100, bernd@kalwar.net <bernd@kalwar.net> wrote:
> > Did you restart Postgresql after editing your pg_hba.conf file?
>
> Yes, I did.
>
> thx,
> Bernd
>
>  --- Ursprüngliche Nachricht ---
> Datum: 08.02.2005 19:31
> Von: Scott Marlowe <smarlowe@g2switchworks.com>
> An: bernd@kalwar.net
> Betreff: Re: [GENERAL] Cannot connect to Database
>
> > Did you restart Postgresql after editing your pg_hba.conf file?
> >
> > On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> > > I recvive still the same error-message.
> > >
> > > thx,
> > > Bernd
> > >
> > >  --- Ursprüngliche Nachricht ---
> > > Datum: 08.02.2005 19:14
> > > Von: "Joshua D. Drake" <jd@commandprompt.com>
> > > An: bernd@kalwar.net
> > > Betreff: Re: [GENERAL] Cannot connect to Database
> > >
> > > > bernd@kalwar.net wrote:
> > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
> to
> > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > >
> > > > >
>
> > > > > I start the Server with the -i option, so TCP/IP is activated,
> isn't
> > > it?
> > > > > I want to connect by localhost to my database.
> > > >
> > > >  From the localhost can you:
> > > >
> > > > psql -h 127.0.0.1 -U postgres template1
> > > >
> > > > ?
> > > >
> > > > Sincerely,
> > > >
> > > > Joshua D. Drake
> > > >
> > > >
> > > > >
> > > > > thx,
> > > > >
> > > > > Bernd
> > > > >
> > > > >  --- Ursprüngliche Nachricht ---
> > > > > Datum: 08.02.2005 18:52
> > > > > Von: Lonni J Friedman <netllama@gmail.com>
> > > > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > > >
> > > > >
> > > > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> > > <bernd@kalwar.net>
> > > > >
> > > > > wrote:
> > > > >
> > > > >>>Hi,
> > > > >>>
> > > > >>>everytime I try to connect to my Database with a
> Java-Applikation, I
> > > > >>>recieve only the following Exception:
> > > > >>>
> > > > >>>org.postgresql.util.PSQLException: A connection error has
> occurred:
> > > > >>>org.postgresql.util.PSQLException: FATAL: kein
> pg_hba.conf-Eintrag
> > > > >
> > > > > für
> > > > >
> > > > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«,
> SSL aus
> > > > >>>
> > > > >>>I get the same error-message with other applications, e.g.
> pgaccess,
> > > > >
> > > > > too.
> > > > >
> > > > >>>My pg_hba.conf looks like:
> > > > >>>
> > > > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > >>>METHOD
> > > > >>>
> > > > >>>host    all         all         127.0.0.1
> 255.255.255.255
> > > > >
> > > > > trust
> > > > >
> > > > >>>The database and the applications are on the same host.
> > > > >>>
> > > > >>>What could be the problem.
> > > > >>
> > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
> to
> > > > >>connect via localhost (127.0.0.1) or some other route?


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama@gmail.com
LlamaLand                       http://netllama.linux-sxs.org

Re: Cannot connect to Database

От
Tom Lane
Дата:
bernd@kalwar.net writes:
> everytime I try to connect to my Database with a Java-Applikation, I
> recieve only the following Exception:

> org.postgresql.util.PSQLException: A connection error has occurred:
> org.postgresql.util.PSQLException: FATAL: kein pg_hba.conf-Eintrag f�r
> Host �127.0.0.1�, Benutzer �postgres�, Datenbank �test�, SSL aus

> I get the same error-message with other applications, e.g. pgaccess, too.

> My pg_hba.conf looks like:

> # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> METHOD

> host    all         all         127.0.0.1         255.255.255.255   trust

It is simply not possible that you get that error message with that
pg_hba.conf.  One way or another, the postmaster you are talking to is
using some other pg_hba.conf than you think it is.  Maybe you are
connecting to a different postmaster, or maybe you are editing the wrong
copy of pg_hba.conf (we've seen several people make the latter mistake
--- the relevant one is the one in the postmaster's data directory).

Or you forgot to SIGHUP the postmaster after editing the file, though
you say you did that.

            regards, tom lane

Re: Cannot connect to Database

От
Scott Marlowe
Дата:
Is postgresql on the same machine as your applicaiton?

Are you sure postgresql is starting up in the directory you think it is?

On Tue, 2005-02-08 at 12:44, bernd@kalwar.net wrote:
> > Did you restart Postgresql after editing your pg_hba.conf file?
>
> Yes, I did.
>
> thx,
> Bernd
>
>  --- Ursprüngliche Nachricht ---
> Datum: 08.02.2005 19:31
> Von: Scott Marlowe <smarlowe@g2switchworks.com>
> An: bernd@kalwar.net
> Betreff: Re: [GENERAL] Cannot connect to Database
>
> > Did you restart Postgresql after editing your pg_hba.conf file?
> >
> > On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> > > I recvive still the same error-message.
> > >
> > > thx,
> > > Bernd
> > >
> > >  --- Ursprüngliche Nachricht ---
> > > Datum: 08.02.2005 19:14
> > > Von: "Joshua D. Drake" <jd@commandprompt.com>
> > > An: bernd@kalwar.net
> > > Betreff: Re: [GENERAL] Cannot connect to Database
> > >
> > > > bernd@kalwar.net wrote:
> > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
> to
> > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > >
> > > > >
>
> > > > > I start the Server with the -i option, so TCP/IP is activated,
> isn't
> > > it?
> > > > > I want to connect by localhost to my database.
> > > >
> > > >  From the localhost can you:
> > > >
> > > > psql -h 127.0.0.1 -U postgres template1
> > > >
> > > > ?
> > > >
> > > > Sincerely,
> > > >
> > > > Joshua D. Drake
> > > >
> > > >
> > > > >
> > > > > thx,
> > > > >
> > > > > Bernd
> > > > >
> > > > >  --- Ursprüngliche Nachricht ---
> > > > > Datum: 08.02.2005 18:52
> > > > > Von: Lonni J Friedman <netllama@gmail.com>
> > > > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > > >
> > > > >
> > > > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> > > <bernd@kalwar.net>
> > > > >
> > > > > wrote:
> > > > >
> > > > >>>Hi,
> > > > >>>
> > > > >>>everytime I try to connect to my Database with a
> Java-Applikation, I
> > > > >>>recieve only the following Exception:
> > > > >>>
> > > > >>>org.postgresql.util.PSQLException: A connection error has
> occurred:
> > > > >>>org.postgresql.util.PSQLException: FATAL: kein
> pg_hba.conf-Eintrag
> > > > >
> > > > > für
> > > > >
> > > > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank »test«,
> SSL aus
> > > > >>>
> > > > >>>I get the same error-message with other applications, e.g.
> pgaccess,
> > > > >
> > > > > too.
> > > > >
> > > > >>>My pg_hba.conf looks like:
> > > > >>>
> > > > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > >>>METHOD
> > > > >>>
> > > > >>>host    all         all         127.0.0.1
> 255.255.255.255
> > > > >
> > > > > trust
> > > > >
> > > > >>>The database and the applications are on the same host.
> > > > >>>
> > > > >>>What could be the problem.
> > > > >>
> > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you trying
> to
> > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > >>
> > > > >>--
> > > >
> >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > >>L. Friedman                                    netllama@gmail.com
> > > > >>LlamaLand                       http://netllama.linux-sxs.org
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > ---------------------------(end of
> > > broadcast)---------------------------
> > > > > TIP 5: Have you checked our extensive FAQ?
> > > > >
> > > > >                http://www.postgresql.org/docs/faq
> > > >
> > > >
> > > > --
> > > > Command Prompt, Inc., your source for PostgreSQL replication,
> > > > professional support, programming, managed services, shared
> > > > and dedicated hosting. Home of the Open Source Projects plPHP,
> > > > plPerlNG, pgManage,  and pgPHPtoolkit.
> > > > Contact us now at: +1-503-667-4564 - http://www.commandprompt.com
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
I've already shutdown my firewall.
My OS is Linux (SuSE 9.2 64Bit)

My postgre version is 7.4.6

and the port is on listen-mode

postgres@amd64:/home/bernd> netstat -an | grep 5432
tcp        0      0 0.0.0.0:5432            0.0.0.0:*
LISTEN
tcp        0      0 :::5432                 :::*
LISTEN
unix  2      [ ACC ]     STREAM     HÖRT         15159
/tmp/.s.PGSQL.5432

thx,
Bernd
 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 19:56
Von: Lonni J Friedman <netllama@gmail.com>
An: "bernd@kalwar.net" <bernd@kalwar.net>
Betreff: Re: [GENERAL] Cannot connect to Database

> Well, its obviosly not listening on localhost.  Are you firewalling
> anywhere?  Which OS is this?  Which version of postgresql?
>
> If this is Linux, what do you get from running 'netstat -an | grep 5432'
?
>
> On Tue, 08 Feb 2005 19:44:26 +0100, bernd@kalwar.net <bernd@kalwar.net>
wrote:
> > > Did you restart Postgresql after editing your pg_hba.conf file?
> >
> > Yes, I did.
> >
> > thx,
> > Bernd
> >
> >  --- Ursprüngliche Nachricht ---
> > Datum: 08.02.2005 19:31
> > Von: Scott Marlowe <smarlowe@g2switchworks.com>
> > An: bernd@kalwar.net
> > Betreff: Re: [GENERAL] Cannot connect to Database
> >
> > > Did you restart Postgresql after editing your pg_hba.conf file?
> > >
> > > On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> > > > I recvive still the same error-message.
> > > >
> > > > thx,
> > > > Bernd
> > > >
> > > >  --- Ursprüngliche Nachricht ---
> > > > Datum: 08.02.2005 19:14
> > > > Von: "Joshua D. Drake" <jd@commandprompt.com>
> > > > An: bernd@kalwar.net
> > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > >
> > > > > bernd@kalwar.net wrote:
> > > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you
trying
> > to
> > > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > > >
> > > > > >
> >
> > > > > > I start the Server with the -i option, so TCP/IP is
activated,
> > isn't
> > > > it?
> > > > > > I want to connect by localhost to my database.
> > > > >
> > > > >  From the localhost can you:
> > > > >
> > > > > psql -h 127.0.0.1 -U postgres template1
> > > > >
> > > > > ?
> > > > >
> > > > > Sincerely,
> > > > >
> > > > > Joshua D. Drake
> > > > >
> > > > >
> > > > > >
> > > > > > thx,
> > > > > >
> > > > > > Bernd
> > > > > >
> > > > > >  --- Ursprüngliche Nachricht ---
> > > > > > Datum: 08.02.2005 18:52
> > > > > > Von: Lonni J Friedman <netllama@gmail.com>
> > > > > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > > > >
> > > > > >
> > > > > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> > > > <bernd@kalwar.net>
> > > > > >
> > > > > > wrote:
> > > > > >
> > > > > >>>Hi,
> > > > > >>>
> > > > > >>>everytime I try to connect to my Database with a
> > Java-Applikation, I
> > > > > >>>recieve only the following Exception:
> > > > > >>>
> > > > > >>>org.postgresql.util.PSQLException: A connection error has
> > occurred:
> > > > > >>>org.postgresql.util.PSQLException: FATAL: kein
> > pg_hba.conf-Eintrag
> > > > > >
> > > > > > für
> > > > > >
> > > > > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank
»test«,
> > SSL aus
> > > > > >>>
> > > > > >>>I get the same error-message with other applications, e.g.
> > pgaccess,
> > > > > >
> > > > > > too.
> > > > > >
> > > > > >>>My pg_hba.conf looks like:
> > > > > >>>
> > > > > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > > >>>METHOD
> > > > > >>>
> > > > > >>>host    all         all         127.0.0.1
> > 255.255.255.255
> > > > > >
> > > > > > trust
> > > > > >
> > > > > >>>The database and the applications are on the same host.
> > > > > >>>
> > > > > >>>What could be the problem.
> > > > > >>
> > > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you
trying
> > to
> > > > > >>connect via localhost (127.0.0.1) or some other route?
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> L. Friedman                                    netllama@gmail.com
> LlamaLand                       http://netllama.linux-sxs.org
>


Re: Cannot connect to Database

От
bernd@kalwar.net
Дата:
That was it. i've two hb_conf-Files on my system.

Now I can connect without any problems.

thx

 --- Ursprüngliche Nachricht ---
Datum: 08.02.2005 20:06
Von: Scott Marlowe <smarlowe@g2switchworks.com>
An: bernd@kalwar.net
Betreff: Re: [GENERAL] Cannot connect to Database

> Is postgresql on the same machine as your applicaiton?
>
> Are you sure postgresql is starting up in the directory you think it
is?
>
> On Tue, 2005-02-08 at 12:44, bernd@kalwar.net wrote:
> > > Did you restart Postgresql after editing your pg_hba.conf file?
> >
> > Yes, I did.
> >
> > thx,
> > Bernd
> >
> >  --- Ursprüngliche Nachricht ---
> > Datum: 08.02.2005 19:31
> > Von: Scott Marlowe <smarlowe@g2switchworks.com>
> > An: bernd@kalwar.net
> > Betreff: Re: [GENERAL] Cannot connect to Database
> >
> > > Did you restart Postgresql after editing your pg_hba.conf file?
> > >
> > > On Tue, 2005-02-08 at 12:22, bernd@kalwar.net wrote:
> > > > I recvive still the same error-message.
> > > >
> > > > thx,
> > > > Bernd
> > > >
> > > >  --- Ursprüngliche Nachricht ---
> > > > Datum: 08.02.2005 19:14
> > > > Von: "Joshua D. Drake" <jd@commandprompt.com>
> > > > An: bernd@kalwar.net
> > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > >
> > > > > bernd@kalwar.net wrote:
> > > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you
trying
> > to
> > > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > > >
> > > > > >
> >
> > > > > > I start the Server with the -i option, so TCP/IP is
activated,
> > isn't
> > > > it?
> > > > > > I want to connect by localhost to my database.
> > > > >
> > > > >  From the localhost can you:
> > > > >
> > > > > psql -h 127.0.0.1 -U postgres template1
> > > > >
> > > > > ?
> > > > >
> > > > > Sincerely,
> > > > >
> > > > > Joshua D. Drake
> > > > >
> > > > >
> > > > > >
> > > > > > thx,
> > > > > >
> > > > > > Bernd
> > > > > >
> > > > > >  --- Ursprüngliche Nachricht ---
> > > > > > Datum: 08.02.2005 18:52
> > > > > > Von: Lonni J Friedman <netllama@gmail.com>
> > > > > > An: "bernd@kalwar.net" <bernd@kalwar.net>
> > > > > > Betreff: Re: [GENERAL] Cannot connect to Database
> > > > > >
> > > > > >
> > > > > >>On Tue, 08 Feb 2005 18:46:00 +0100, bernd@kalwar.net
> > > > <bernd@kalwar.net>
> > > > > >
> > > > > > wrote:
> > > > > >
> > > > > >>>Hi,
> > > > > >>>
> > > > > >>>everytime I try to connect to my Database with a
> > Java-Applikation, I
> > > > > >>>recieve only the following Exception:
> > > > > >>>
> > > > > >>>org.postgresql.util.PSQLException: A connection error has
> > occurred:
> > > > > >>>org.postgresql.util.PSQLException: FATAL: kein
> > pg_hba.conf-Eintrag
> > > > > >
> > > > > > für
> > > > > >
> > > > > >>>Host »127.0.0.1«, Benutzer »postgres«, Datenbank
»test«,
> > SSL aus
> > > > > >>>
> > > > > >>>I get the same error-message with other applications, e.g.
> > pgaccess,
> > > > > >
> > > > > > too.
> > > > > >
> > > > > >>>My pg_hba.conf looks like:
> > > > > >>>
> > > > > >>># TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > > >>>METHOD
> > > > > >>>
> > > > > >>>host    all         all         127.0.0.1
> > 255.255.255.255
> > > > > >
> > > > > > trust
> > > > > >
> > > > > >>>The database and the applications are on the same host.
> > > > > >>>
> > > > > >>>What could be the problem.
> > > > > >>
> > > > > >>Do you have TCP/IP activated in postgresql.conf ?  Are you
trying
> > to
> > > > > >>connect via localhost (127.0.0.1) or some other route?
> > > > > >>
> > > > > >>--
> > > > >
> >
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > >>L. Friedman
netllama@gmail.com
> > > > > >>LlamaLand                       http://netllama.linux-sxs.org
> > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > > > > ---------------------------(end of
> > > > broadcast)---------------------------
> > > > > > TIP 5: Have you checked our extensive FAQ?
> > > > > >
> > > > > >                http://www.postgresql.org/docs/faq
> > > > >
> > > > >
> > > > > --
> > > > > Command Prompt, Inc., your source for PostgreSQL replication,
> > > > > professional support, programming, managed services, shared
> > > > > and dedicated hosting. Home of the Open Source Projects plPHP,
> > > > > plPerlNG, pgManage,  and pgPHPtoolkit.
> > > > > Contact us now at: +1-503-667-4564 -
http://www.commandprompt.com
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > ---------------------------(end of
> > broadcast)---------------------------
> > > > TIP 1: subscribe and unsubscribe commands go to
> > majordomo@postgresql.org
> > >
> >
> >
> > ---------------------------(end of
broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
>