Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client

From: "Faith, Jeremy" <jfaith(at)tycoint(dot)com>
To: Stefan Viljoen <viljoens(at)verishare(dot)co(dot)za>, "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client
Date: 2015-07-20 11:17:26
Message-ID: 55BAADA01D8C504993894EAEA7517CF81246DB@003FCH1MPN2-002.003f.mgd2.msft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Stefan,

It does seem that psql is connecting on IPv6.

I think your /etc/hosts file is fine but just to be certain you could try
psql -h 127.0.0.1 ...
if this works it is probably NOT the problem.

Regards,
Jeremy Faith
________________________________________
From: pgsql-odbc-owner(at)postgresql(dot)org [pgsql-odbc-owner(at)postgresql(dot)org] on behalf of Stefan Viljoen [viljoens(at)verishare(dot)co(dot)za]
Sent: 20 July 2015 11:59
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: [ODBC] Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client

Hi Jeremy

>I had thought perhaps psql was using unix domain socket(/tmp) and not
localhost but as psql -h localhost ...
>works for you that is NOT the problem.

>Just one last thing to check if you run
>grep localhost /etc/hosts
>what do you get. In particular is the 127.0.0.1 line(IPv4) before the ::1
line(ipv6).

This is the output:

---
[root(at)jhbasterisk ~]# grep localhost /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4
localhost4.localdomain4
::1 localhost localhost.localdomain localhost6
localhost6.localdomain6
[root(at)jhbasterisk ~]#
---

One thing I did notice though. When I was initially setting up postgress,
the last line of my pg_hba.conf was

---
host all all ::1/128 trust
---

And I could not get access with psql to the running postgres instance.

Changing the last line to

---
host all all ::1/128 ident
---

also caused that I could not get access with psql to the running postgres
instance (restarting postgres after changing pg_hba.conf each time, of
course).

Only when I put

---
host all all ::1/128 md5
---

as the last line of pg_hba.conf and restarted postgres, could I get access
with psql to the running postgres instance.

This seems to indicate that I'm running postgres on IPV6 (unintentionally)
instead of IPV4?

I just want / need IPV4 functionality, IPV6 is unneccessary.

HOWEVER

Can this be why unixODBC is not working? E. g. it is string to connect to
postgres but it is ignoring IPV4 requests?

My current pg_hba.conf does allow IPV4:

---
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
---

I can drop the first two lines and nothing changes - psql still works and
isql still does NOT work - but drop the very last line and psql AND isql
don't work.

Ergo... IPV6 is being used by postgres and IPV4 traffic is completely
ignored?

I have not tried to connect to the box in question from any host besides
local.

Thanks for the assistance.

Kind regards

Stefan

--
Sent via pgsql-odbc mailing list (pgsql-odbc(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Tyco Safety Products/CEM Systems Ltd.

________________________________

This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Stefan Viljoen 2015-07-20 12:07:40 Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client
Previous Message Stefan Viljoen 2015-07-20 10:59:40 Re: Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with isql ODBC commandline client