[OSM-dev] Can't connect to local PostgreSQL database with osmosis

2010-01-19 Thread Ævar Arnfjörð Bjarmason
I can't connect to postgresql database that I can connect to with
pgsql(1) with osmosis and I can't figure out why this is:

osmosis --read-xml-0.6 /var/www/osm.nix.is/latest/Iceland.osm.bz2
--write-apidb-0.6 populateCurrentTables=yes host=localhost
database=osmistmp user=osmistmp password=osmistmp
validateSchemaVersion=no
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)
[...]

Nothing shows up in postgresql's log which suggests that it really
can't reach the server, but with the psql tool I can talk to the
server over TCP just fine:

$ psql -h localhost -W -U osmistmp osmistmp
Password for user osmistmp:
[...]
osmistmp=

And I'm not having some DNS issues where localhost isn't resolved
(I've also tried to tell it to connect to127.0.0.1):

$ dig +short localhost
127.0.0.1

This is what my pg_hba.conf is like:

$ egrep -v -e ^# -e ^$ /etc/postgresql/8.4/main/pg_hba.conf
local   all postgres  ident
local   all all   ident
hostall all 127.0.0.1/32  md5
hostall all ::1/128   md5

I added some debugging strings to  DatabaseContext.java and found out
that it's getting the connection as:

newConnection =
DriverManager.getConnection(jdbc:postgresql://localhost/osmistmp,
osmistmp, osmistmp);

Which looks fine.

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Can't connect to local PostgreSQL database with osmosis

2010-01-19 Thread Frederik Ramm
Hi,

Ævar Arnfjörð Bjarmason wrote:
 I can't connect to postgresql database that I can connect to with
 pgsql(1) with osmosis and I can't figure out why this is:

Could it be some strange ipv6 issue where one of the applications tries 
to talk to localhost through ipv6? I am by no means an ipv6 expert but I 
have had strange things like this happen to me.

Bye
Frederik

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Can't connect to local PostgreSQL database with osmosis

2010-01-19 Thread Jan-Benedict Glaw
On Tue, 2010-01-19 15:10:11 +0100, Frederik Ramm frede...@remote.org wrote:
 Ævar Arnfjörð Bjarmason wrote:
  I can't connect to postgresql database that I can connect to with
  pgsql(1) with osmosis and I can't figure out why this is:
 
 Could it be some strange ipv6 issue where one of the applications tries 
 to talk to localhost through ipv6? I am by no means an ipv6 expert but I 
 have had strange things like this happen to me.

Either way, a quick strace should show what it is trying to do and
thus give a hint to solve the underlying problem.

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
Signature of: Friends are relatives you make for yourself.
the second  :


signature.asc
Description: Digital signature
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Can't connect to local PostgreSQL database with osmosis

2010-01-19 Thread Ævar Arnfjörð Bjarmason
On Tue, Jan 19, 2010 at 14:10, Frederik Ramm frede...@remote.org wrote:
 Could it be some strange ipv6 issue where one of the applications tries to
 talk to localhost through ipv6? I am by no means an ipv6 expert but I have
 had strange things like this happen to me.

That turned out to be the issue, running:

ifconfig lo down
sysctl -w net.ipv6.conf.all.disable_ipv6=1
ifconfig lo up

Made everything work, thanks!

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev