Re: Connection problems - local IP address refused! - Mailing list pgsql-general

From Edson Richter
Subject Re: Connection problems - local IP address refused!
Date
Msg-id BLU0-SMTP299A92430CAD396573C23EFCF950@phx.gbl
Whole thread Raw
In response to Re: Connection problems - local IP address refused!  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
Em 05/02/2014 15:08, Adrian Klaver escreveu:
> On 02/05/2014 08:53 AM, Edson Richter wrote:
>> Em 05/02/2014 13:03, Adrian Klaver escreveu:
>>> On 02/05/2014 05:43 AM, Edson Richter wrote:
>>>> Em 05/02/2014 11:12, Alban Hertroys escreveu:
>>>>> Are you connecting to the correct host?
>>>>>
>>>>> On 5 February 2014 12:37, Edson Richter <edsonrichter@hotmail.com>
>>>>> wrote:
>>>>>> Without any changes in the configuration files, a **local**
>>>>>> connection to a
>>>>>> local VPN IP address could not be established with the following
>>>>>> error:
>>>>>>
>>>>>> The error (JDBC connection using driver version 1002):
>>>>>> 2014-02-05 09:12:21.111 - xxxxx - org.postgresql.util.PSQLException:
>>>>>> ERROR:
>>>>>> could not establish connection
>>>>>>    Detail: FATAL:  no pg_hba.conf entry for host "10.68.73.6", user
>>>>>> "master",
>>>>>> database "master", SSL off
>>>> Sure! On the exatcly same server:
>>>>
>>>> [root@mylocalserver logs]# psql -h 10.68.73.6 -d master -U master
>>>> Senha para usuário master:
>>>> psql (9.2.6)
>>>> Digite "help" para ajuda.
>>>
>>> The error message:
>>>
>>>  Detail: FATAL:  no pg_hba.conf entry for host "10.68.73.6", user
>>> "master", database "master", SSL off
>>>
>>> indicates your JDBC connection is not connecting to a database with
>>> the pg_hba.conf you think it is.
>>>
>>> What are the connection parameters for the JDBC connection?
>>>
>>> So where is the database running?
>>>
>>> What interface is it listening on?
>>>
>>> I know it has been asked, but is there another Postgres instance
>>> running?
>>>
>>>
>> Well, there is only one PostgreSQL database running in this machine. It
>> has three interfaces:
>>
>> lo (127.0.0.1)
>> eth0 (xxx.xxx.xxx.xxx)
>> tun0 (10.68.73.6)
>>
>> PostgreSQL is configured to listen_adrress =  '*'
>> Firewall allows evertyhing from lo and tun0.
>> AFAIK (please correct me if I'm wrong) JDBC knows nothing about
>> pg_hba.conf; this error message comes from PostgresSQL, don't?
>> I can connect in the very same machine using psql. It is really weird
>> problem.
>
> Your JDBC connection does not 'know' about pg_hba.conf but it is
> triggering the error and capturing the exception:
>
> 2014-02-05 09:12:21.111 - xxxxx - org.postgresql.util.PSQLException:
> ERROR: could not establish connection
>
> It would seem something about the JDBC connection is incorrect. This
> is why I asked for the connection parameters in the JDBC connection.
> For some reason it is not connecting in the same manner as psql. The
> chore now is to find out why?
>

You are right. And then, problem becomes even more weird. The JDBC
connection is:

  <Resource auth="Container" description="Master Database"
               driverClassName="org.postgresql.Driver"
               maxActive="5" maxIdle="0" name="jdbc/master"
               username="master" password="xxxx"
               type="javax.sql.DataSource"
               removeAbandoned="true" removeAbandonedTimeout="60"
               logAbandoned="true"
url="jdbc:postgresql://127.0.0.1:5432/master?charset=UTF-8"/>

Must be something related to reverse address resolution (converting from
127.0.0.1 to "MyLocalServer" and then "MyLocalServer" is being mapped to
10.68.73.6), must be affected by the VPN.
I just can't figure out why and where...

Edson

>>
>> I'll need to dig a bit more.
>>
>> Edson
>>
>>
>>
>
>



pgsql-general by date:

Previous
From: CS DBA
Date:
Subject: JDBC performance issue
Next
From: Dave Cramer
Date:
Subject: Re: JDBC performance issue