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 AD24653A47 for ; Sat, 9 Apr 2005 03:18:42 +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 13915-07 for ; Sat, 9 Apr 2005 02:18:39 +0000 (GMT) Received: from hotmail.com (bay18-f28.bay18.hotmail.com [65.54.187.78]) by svr1.postgresql.org (Postfix) with ESMTP id B6956535F9 for ; Sat, 9 Apr 2005 03:18:38 +0100 (BST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 8 Apr 2005 19:18:42 -0700 Message-ID: Received: from 200.216.48.228 by by18fd.bay18.hotmail.msn.com with HTTP; Sat, 09 Apr 2005 02:18:42 GMT X-Originating-IP: [200.216.48.228] X-Originating-Email: [napalmblood@hotmail.com] X-Sender: napalmblood@hotmail.com From: "Pedro n/a" 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 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed X-OriginalArrivalTime: 09 Apr 2005 02:18:42.0614 (UTC) FILETIME=[73481D60:01C53CAA] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.338 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER, RCVD_IN_NJABL_PROXY X-Spam-Level: ** X-Archive-Number: 200504/54 X-Sequence-Number: 12661 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 To: Pedro n/a 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