pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: david@mediagonal.ch
Cc: pgsql-jdbc@postgresql.org
Subject: Re: jdbc connection problem
Date: Thu, 1 Feb 2007 12:33:39 -0500 (EST)
Message-ID: <Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net> (raw)
In-Reply-To: <a3a08b525eff59fd0a1526e17f2194e5@localhost>
References: <a3a08b525eff59fd0a1526e17f2194e5@localhost>



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



view thread (18+ messages)  latest in thread

Message-ID: <Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net>
Permalink:  ../Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net

 · 

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: books@ejurka.com, david@mediagonal.ch
  Subject: Re: jdbc connection problem
  In-Reply-To: <Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net>
  References: <a3a08b525eff59fd0a1526e17f2194e5@localhost> <Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net>

* 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