pg_hba.conf reversed behaviour from 8.1.0beta3 -> 8.1.0 using JDBC

From: "Vidar Steen" <vidarsteen(at)hotmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: pg_hba.conf reversed behaviour from 8.1.0beta3 -> 8.1.0 using JDBC
Date: 2005-11-25 16:45:09
Message-ID: BAY109-F3275A016CEF6CD05811200CE570@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi
I'm developing a 'datarepository' to an application that other people are
working on.
My app will be a java app with no gui pipeing requests for fetching/storing
of data to/from postgresql.
In early testing i've run postgresql8.1.0beta3 on a linux box and the java
app on a windows box
connecting using postgresql-8.1-404.jdbc3.jar . Opening up the windows box
ip in pg_hba.conf enabled me to
connect just fine... eg.
>>host target vist 192.168.1.1 trust

--Connection to PostgreSQL 8.1.0 successful.
--update with preparedStatement of 1000 rows took 5 sec.

Thinking that i might get better performance if I ran my java agent localy
on the same box as
postgresql I deployed it there and to my surprise I couldn't connect to pg.
No matter what i entered into pg_hba .conf i couldn't connect running the
agent locally but remotely worked just fine.
Fiddling with entrys in pg_hba.conf AND 'reload':ing pg made the REMOTE
application able/unable to connect as expected, but no amount of effort made
it possible to connect running it on the same box.

This morning I moved from 8.1beta3 to 8.1.0 and to my surprise the scenario
is now completly inverse.
Now I can ONLY connect to pg from my java app running on the same box as pg
,but not from anywhere else
no matter what I enter into pg_hba.conf. And YES I reload pg after each mod
to pg_hba, that bit me more than once too :)

I've tried a lot of combinations i pg_hba listed below. not at the same time
though as if I read and understand the doc correctly
the first rule that excludes a connection is the one being used.
from the 8.1.0 Documentation
----
20.1
There is no fall-through or backup: if one record
is chosen and the authentication fails, subsequent records are not
considered. If no record matches,
access is denied.
----
Even entering
host all all 0.0.0.0/0 trust
doesn't do the trick.

If you have any idea about whats going on please drop a line because i'm at
whits end here having fiddled with this for almost two full days now.
regards
/Vidar

Below are printouts from my first test app.
To repeat myself the outcome were exactly inverse using 8.1.0 and 8.1.0beta3
with the same exception was thrown in both cases.

Case 1:

connecting with Java 1.5_05 from another network.
--Reading propsfile:
C:\data\dev\SituationAssessment:/data/dev/SituationAssessment/src/sa.properties
--> rowsToInsert:1000
--> //dbHost:localhost
--> db:target
--> dbPort:5432
--> dbHost:139.58.165.51
--> username:vist
--org.postgresql.util.PSQLException: Connection refused. Check that the
hostname and port are correct and that the postmaster is accepting TCP/IP

connections.-- at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)-- at

org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)-- at

org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)-- at

org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)-- at

org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)-- at
org.postgresql.Driver.makeConnection(Driver.java:369)-- at

org.postgresql.Driver.connect(Driver.java:245)-- at
java.sql.DriverManager.getConnection(DriverManager.java:525)
[snip]
Case 2:

java 1.4.2 on the same linux box as pg.
[vist(at)florens jabba]$ env CLASSPATH=. java -cp
./postgresql-8.1-404.jdbc3.jar se.mycompany.jabba sa.properties
--user.dir: /home/vist/jabba
--Reading propsfile: /home/vist/jabba:sa.properties
--> //dbHost:florens
--> dbPort:5432
--> db:target
--> rowsToInsert:1000
--> username:vist
--> dbHost:127.0.0.1
--Connection to PostgreSQL 8.1.0 successful.
--update with preparedStatement of 1000 rows took 5 sec.
--commit update with preparedStatement of 1000 rows took 4 sec.
--update with insert into allan values (314,'insert','lkcxs','cssclcn')
1000 times took 2 sec.
--update with modded sqlInsert in for loop 1000 times took 2 sec.

end printout

target=> select version();
version
---------------------------------------------------------------------------------------------------
PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.0
20050519 (Red Hat 4.0.0-8)
(1 row)

Browse pgsql-novice by date

  From Date Subject
Next Message manjusri schuit 2005-11-25 22:33:30 Re: Problem Upgrading from 8.0 to 8.1 (WinXP) ...not still solved!!
Previous Message John Koller 2005-11-25 16:38:37 Re: Schemas, databases, and backups