Your message dated Mon, 16 May 2011 20:16:35 +0100
with message-id <[email protected]>
and subject line Close #570914 (libpg-java)
has caused the Debian Bug report #570914,
regarding libpg-java: Can't establish a database connection to localhost if it
has an IPv6 address
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
570914: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570914
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libpg-java
Version: 8.4-701-1
Severity: important
When I try to connect to a valid database with a valid user/password
on localhost I get an error like this:
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to
establish a database connection.
at
org.openstreetmap.osmosis.core.apidb.common.DatabaseContext.getPostgresConnection(DatabaseContext.java:111)
[...]
Caused by: org.postgresql.util.PSQLException: The connection attempt
failed.
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:150)
[...]
Caused by: java.net.SocketException: Network is unreachable
at java.net.PlainSocketImpl.socketConnect(Native Method)
[...]
The reason is seemingly that the Java driver tries to connect to the
local IPv6 address for "localhost", here's what my localhost
configuration is like:
$ sudo ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
If I then do:
sysctl -w net.ipv6.conf.all.disable_ipv6=1
Which changes it to this:
$ sudo ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
I can connect successfully to the PostgreSQL database from Java.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (650, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-x86_64-linode11 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libpg-java depends on:
ii sun-java6-jre [java2-runtime- 6-16-1 Sun Java(TM) Runtime Environment (
libpg-java recommends no packages.
Versions of packages libpg-java suggests:
pn postgresql <none> (no description available)
-- no debconf information
--- End Message ---
--- Begin Message ---
Since I can't reproduce this, and changes in the JVM should hopefully
have fixed it, I'm closing this.
Andy
--- End Message ---