Thread: UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

From
JORGE MALDONADO
Date:
I am writing a web app which should connect to a database in a server within my personal network but I am having trouble. I get the following error message:
 
There is no record on pg_hba.conf for 192.168.1.77, user postgres, database restaurant, SSL inactive.
 
I have checked the configuration files on the server machine as follows:
* The listen_addresses parameter in postgresql.conf equals *.
* The pg_hba.conf has an entry of type=host, database=all, user=all, IP-Address=192.168.1.77/32, Password=md5.
 
I have tried changing the IP-Address to 192.168.1.0/24 and 192.168.0.0/16; also I tried Password=Trust and Password=Password.
 
What else can I check?
 
Respectfully,
Jorge Maldonado

Re: UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

From
Tony Day
Date:
Hi Jorge

I would perhaps try:

type=hostnossl, database=all, user=all, cidr-address=192.168.1.0/24, method=trust

Please keep in mind that I am also very much a novice so this is a case of the "blind trying to lead the blind ..." :-)

Regards, Tony


On Thu, May 27, 2010 at 9:45 AM, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
I am writing a web app which should connect to a database in a server within my personal network but I am having trouble. I get the following error message:
 
There is no record on pg_hba.conf for 192.168.1.77, user postgres, database restaurant, SSL inactive.
 
I have checked the configuration files on the server machine as follows:
* The listen_addresses parameter in postgresql.conf equals *.
* The pg_hba.conf has an entry of type=host, database=all, user=all, IP-Address=192.168.1.77/32, Password=md5.
 
I have tried changing the IP-Address to 192.168.1.0/24 and 192.168.0.0/16; also I tried Password=Trust and Password=Password.
 
What else can I check?
 
Respectfully,
Jorge Maldonado

Re: UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

From
Joshua Tolley
Date:
On Wed, May 26, 2010 at 11:47:03AM -0500, JORGE MALDONADO wrote:
>    I have checked the configuration files on the server machine as follows:
>    * The listen_addresses parameter in postgresql.conf equals *.
>    * The pg_hba.conf has an entry of type=host, database=all, user=all,
>    IP-Address=192.168.1.77/32, Password=md5.

Your listen_addresses setting clearly has taken effect, or you
wouldn't get the error message you report, but after creating that entry in
pg_hba.conf, did you reload the configs or restart the database? Another
possibility is that you've got some other entry overriding the one you
created, earlier in the pg_hba.conf file. Perhaps you could post your entire
pg_hba.conf.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Attachment

Re: UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

From
"A. Kretschmer"
Date:
In response to JORGE MALDONADO :
> I am writing a web app which should connect to a database in a server within my
> personal network but I am having trouble. I get the following error message:
>  
> There is no record on pg_hba.conf for 192.168.1.77, user postgres, database
> restaurant, SSL inactive.
>  
> I have checked the configuration files on the server machine as follows:
> * The listen_addresses parameter in postgresql.conf equals *.
> * The pg_hba.conf has an entry of type=host, database=all, user=all, IP-Address
> =192.168.1.77/32, Password=md5.

Is that the real entry? If yes, so it is a wrong syntax...

Other question: there are no firewall between?


Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

Re: UNABLE TO CONNECT TO A DATABASE IN A WEB SERVER.

From
Andreas Schmitz
Date:
the entry should like

host    all         all         192.168.1.77/32          password

or

host    all         all         192.168.1.0/24          password


do not forget to reload the server (pg_ctl reload) when making changes
to pg_hba.conf


try connecting to the DB manually from the webserver

psql -h <hostname> <dbname> -U <username>


if you still have problems change the setting password to trust and try
again to make sure the problem is related to the network and not to the
auth mechanism.

regards

andreas




JORGE MALDONADO wrote:
> I am writing a web app which should connect to a database in a server
> within my personal network but I am having trouble. I get the
> following error message:
>
> There is no record on pg_hba.conf for 192.168.1.77, user postgres,
> database restaurant, SSL inactive.
>
> I have checked the configuration files on the server machine as follows:
> * The listen_addresses parameter in postgresql.conf equals *.
> * The pg_hba.conf has an entry of type=host, database=all, user=all,
> IP-Address=192.168.1.77/32 <http://192.168.1.77/32>, Password=md5.
>
> I have tried changing the IP-Address to 192.168.1.0/24
> <http://192.168.1.0/24> and 192.168.0.0/16 <http://192.168.0.0/16>;
> also I tried Password=Trust and Password=Password.
>
> What else can I check?
>
> Respectfully,
> Jorge Maldonado