Re: ignore TCP/IP question

Lists: pdxpug
From: Thomas Keller <kellert(at)ohsu(dot)edu>
To: Postgresql PDX_Users <pdxpug(at)postgresql(dot)org>
Subject: ignore TCP/IP question
Date: 2008-03-01 21:46:49
Message-ID: DF06EA02-6019-468D-A519-199786DCEC6A@ohsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pdxpug

Well, I investigated the cgi script using DBI and DBD::Pg that was
giving the error and discovered the connection string was the problem.
This is still curious, and I'd like to know why but I was able to fix
it.
Here's the old $dsn variable: ## this gave the "can't connect" error.
my $dsn = 'dbi:Pg:dbname=db_name;host=server_name';

This fixed the problem:
my $dsn = 'dbi:Pg:dbname=db_name';

So maybe there is something not quite right in my pg_hba.conf file. ??

thanks for any insights.

Tom
MMI Shared Resource Facility
503-494-2442
kellert at ohsu.edu


From: "Selena Deckelmann" <selenamarie(at)gmail(dot)com>
To: "Thomas Keller" <kellert(at)ohsu(dot)edu>
Cc: "Postgresql PDX_Users" <pdxpug(at)postgresql(dot)org>
Subject: Re: ignore TCP/IP question
Date: 2008-03-02 18:36:15
Message-ID: 2b5e566d0803021036g7e476c24h9044aad1a941e6a9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pdxpug

On Sat, Mar 1, 2008 at 1:46 PM, Thomas Keller <kellert(at)ohsu(dot)edu> wrote:
> Well, I investigated the cgi script using DBI and DBD::Pg that was giving
> the error and discovered the connection string was the problem.
> This is still curious, and I'd like to know why but I was able to fix it.
> Here's the old $dsn variable: ## this gave the "can't connect" error.
> my $dsn = 'dbi:Pg:dbname=db_name;host=server_name';
>
> This fixed the problem:
> my $dsn = 'dbi:Pg:dbname=db_name';
>
> So maybe there is something not quite right in my pg_hba.conf file. ??

http://www.postgresql.org/docs/8.3/static/auth-pg-hba-conf.html

By default, PostgreSQL is only listening for connection requests to
localhost. DBD::Pg's default connection host is localhost.

To change this, you need to do two things:

http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-LISTEN-ADDRESSES

To have postgresql listen on all local interfaces, you could add:

listen_addresses = '*'

to postgresql.conf. Or you can specify the particular IP addresses.

And then you need to add a line to pg_hba.conf:

host all all 192.168.0.100/32 password

This line would allow connections to any database, by any user coming
from IP address 192.168.0.100 and require a password.

-selena

--
Selena Deckelmann
PDXPUG - Portland PostgreSQL Users Group
http://pugs.postgresql.org/pdx
http://www.chesnok.com/daily