X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 13DFD536DC for ; Sat, 9 Apr 2005 00:02:36 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68751-07 for ; Fri, 8 Apr 2005 23:02:27 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 0670D536B0 for ; Sat, 9 Apr 2005 00:02:25 +0100 (BST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DK2Ud-000727-Ej; Sat, 09 Apr 2005 11:02:27 +1200 Message-ID: <42570D82.5070201@opencloud.com> Date: Sat, 09 Apr 2005 11:02:26 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pedro n/a Cc: pgsql-jdbc@postgresql.org Subject: Re: Exception "The connection attempt failed." (didn't find References: In-Reply-To: X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/51 X-Sequence-Number: 12658 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