pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pedro n/a <napalmblood@hotmail.com>
To: pgsql-jdbc@postgresql.org
Subject: FW: Re: Exception "The connection attempt failed." (didn't find anything
Date: Fri, 08 Apr 2005 23:18:42 -0300
Message-ID: <BAY18-F28E1A117197AC310688642BA300@phx.gbl> (raw)

I'm ashamed, the problem was exactly there!

I'm using a FreeBSD 5.4#PRE-RELEASE box and I was editing the 'hosts' file 
the other day, experimenting some things with samba just when I forgot to 
uncomment some tests I did... Don't know where I was with my mind!!!

Thanks again!
Pedro

From: Oliver Jowett <oliver@opencloud.com>
To: Pedro n/a <napalmblood@hotmail.com>
CC: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Exception "The connection attempt failed." (didn't find 
anything elsewhere)
Date: Sat, 09 Apr 2005 11:02:26 +1200

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(PlainSocketImpl.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:databasename' use something like
'jdbc:postgresql://127.0.0.1/databasename'.

-O

_________________________________________________________________
Chegou o que faltava: MSN Acesso Grátis. Instale Já! 
http://www.msn.com.br/discador




view thread (3+ messages)

Message-ID: <BAY18-F28E1A117197AC310688642BA300@phx.gbl>
Permalink:  ../BAY18-F28E1A117197AC310688642BA300@phx.gbl/
Also on:    postgresql.org/message-id/BAY18-F28E1A117197AC310688642BA300@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: napalmblood@hotmail.com
  Subject: Re: FW: Re: Exception "The connection attempt failed." (didn't find anything
  In-Reply-To: <BAY18-F28E1A117197AC310688642BA300@phx.gbl>
  References: <BAY18-F28E1A117197AC310688642BA300@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox