Skip site navigation (1) Skip section navigation (2)

Re: jdbc connection problem

From: Kris Jurka <books(at)ejurka(dot)com>
To: david(at)mediagonal(dot)ch
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc connection problem
Date: 2007-02-01 17:33:39
Message-ID: Pine.BSO.4.64.0702011232170.7805@leary2.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Thu, 1 Feb 2007, david(at)mediagonal(dot)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

In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-02-01 17:52:45
Subject: Re: getArray() and char[]
Previous:From: Kris JurkaDate: 2007-02-01 17:32:05
Subject: Re: Any reason for PSQLState not to be Serializable?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group