Home > Archive > PostgreSQL JDBC > April 2005 > Re: Exception "The connection attempt failed." (didn't find









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Exception "The connection attempt failed." (didn't find
Oliver Jowett

2005-04-09, 8:26 pm

Pedro n/a wrote:

> I'm quite new at java and I was just following a tutorial when I bumped
> with a horrible exception. [...]


> Caused by: java.net. UnknownHostException
: localhost
> at java.net.PlainSocketImpl. connect(PlainSocketI
mpl.java:153)


This is the underlying problem. If you do not specify a host to connect
to, the JDBC driver defaults to connecting to localhost, but for some
reason your system cannot resolve localhost.

The solution is to fix hostname resolution on your system. I can't give
you any suggestions as to how to do this as you didn't say anything
about the OS that you are using, but something is pretty broken if you
can't resolve localhost.

A workaround might be to provide an explicit IP address in the driver
URL, e.g. instead of 'jdbc:postgresql:dat
abasename' use something like
'jdbc:postgresql://127.0.0.1/databasename'.

-O

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com