Re: pgsql-jdbc and ident - Mailing list pgsql-jdbc

From Matt Rose
Subject Re: pgsql-jdbc and ident
Date
Msg-id 20130304151111.GC12543@oscar.engineering.n-able.com
Whole thread Raw
In response to Re: pgsql-jdbc and ident  (Ian Pilcher <arequipeno@gmail.com>)
List pgsql-jdbc
On Sun, Mar 03, 2013 at 10:49:49PM -0500, Ian Pilcher wrote:
> On 03/01/2013 10:04 AM, Matt Rose wrote:
> > I am having the oddest problem with postgresql-9.2-1002.jdbc3.jar doing
> > ident authentication against postgresql-9.2.3
>
> Your ident server might be having a problem recognizing IPv6
> connections, including "IPv4-mapped IPv6 addresses" (see
> http://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses).
>
> Try running your program with -Djava.net.preferIPv4Stack=true to
> determine if your problem is IPv6-related.

Thank you, that was the problem.

[root@localhost ~]# java -jar /home/admin/pgtest.jar
Running as user 'root'
postgresql JDBC Driver Registered!
SQLException: FATAL: Ident authentication failed for user "sqlrelay"
SQLState: 28000
VendorError: 0
Exception in thread "main" java.lang.NullPointerException
    at
net.folkwolf.PostgreSQLJDBCDriverTest.main(PostgreSQLJDBCDriverTest.java:35)
[root@localhost ~]# java -jar -Djava.net.preferIPv4Stack=true
/home/admin/pgtest.jar
Running as user 'root'
postgresql JDBC Driver Registered!

For some reason, even if you specify an ipv4 address in the connection
url, the jdbc driver only connects successfully over ipv6.

I have some ideas as to why this happens, but I can mull them over
later.  Thanks again.

NB:  Also, when I configure my ident server to listen to ipv6, and add
an ident map to pg_hba.conf to listen to ipv6 localhost, it also works.

Matt

>
> --
> ========================================================================
> Ian Pilcher                                         arequipeno@gmail.com
> Sometimes there's nothing left to do but crash and burn...or die trying.
> ========================================================================
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc

--
Matt Rose, Systems Engineer, N-able Technologies: mrose@n-able.com


pgsql-jdbc by date:

Previous
From: Ian Pilcher
Date:
Subject: Re: pgsql-jdbc and ident
Next
From: Jeremy Whiting
Date:
Subject: Re: executeUpdate API contract. Return value equals 0.