Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 05EFB9FA086 for ; Thu, 1 Feb 2007 13:33:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 57312-09 for ; Thu, 1 Feb 2007 13:33:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with ESMTP id 89AC49F9F10 for ; Thu, 1 Feb 2007 13:33:39 -0400 (AST) Received: by mail63.csoft.net (Postfix, from userid 1112) id 2E968F2D6; Thu, 1 Feb 2007 12:33:39 -0500 (EST) Date: Thu, 1 Feb 2007 12:33:39 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: david@mediagonal.ch cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc connection problem In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/7 X-Sequence-Number: 16563 On Thu, 1 Feb 2007, david@mediagonal.ch wrote: > i have a problem connecting to postgres using the jdbc driver. > > String url = "jdbc:postgresql://localhost/testdb"; > String user = "username"; > String pass = "password"; > > > i get the exception org.postgresql.util.PSQLException: Connection > Refused. Check that the hostname and port are correct and that the > postmaster is accepting TCP/IP connections. > > however, using psql -h localhost -U username -W and then specifying the > password works. so i do not see how this could be a general problem with > postgresql listening on the wrong interface or not accepting connections > from the local host. > > btw, i use psql 8.1.4 on ubuntu, jdbc is postgresql-8.1-408.jdbc2.jar > Debian variants often have multiple servers installed on multiple ports. Try adding explicit port numbers to both psql and jdbc connections to ensure that you're getting the same thing. Kris Jurka