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

Re: [INTERFACES] JDBC Connection

From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
To: Eric Marsden <emarsden(at)mail(dot)dotcom(dot)fr>
Cc: "Dr(dot) Herrera" <drherlams(at)diandel(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] JDBC Connection
Date: 1998-08-24 16:59:58
Message-ID: Pine.LNX.3.96.980824175848.493Y-100000@maidast.retep.org.uk (view raw or flat)
Thread:
Lists: pgsql-interfaces
On 24 Aug 1998, Eric Marsden wrote:

> >>>>> "DrH" == Herrera  <drherlams(at)diandel(dot)com> writes:
> 
>   DrH> I am trying to connect to PostgreSQL from Java (JDK 1.1.6)
>   DrH> under RedHat Linux 5.1 using the JDBC interface. I have
>   DrH> compiled the driver and tried to run the examples this way:
>   DrH> 
>   DrH> java -Djdbc.drivers=postgresql.Driver example.basic jdbc:postgresql:prueba
>   DrH> postgres postgres
>   DrH> 
>   DrH> where 'prueba' is the name of an existing database.
>   DrH> But I always get a 'Connection refused' error in 
>   DrH> DriverManager.getConnection("jdbc:postgresql:prueba")
>   DrH> 
>   DrH> I have modified pg_hba.conf to allow any user on any host
>   DrH> access to any database but the error still remains.
> 
> Possible solution: have you started the database with the `-i' option
> (to allow TCP/IP connections, which are used by the JDBC interface)?

Yes. Java doesn't support Unix domain sockets (without using native code),
so TCP is the only option. When ever "Connection refused" occurs, it's
because there is nothing listening on the port, so -i is the culprit.

> Read the postmaster manual page for more details.  
> 
> -- 
> Eric Marsden
> emarsden @ mail.dotcom.fr
> It's elephants all the way down
> 

-- 
       Peter T Mount peter(at)retep(dot)org(dot)uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf


In response to

pgsql-interfaces by date

Next:From: John SharpDate: 1998-08-24 18:44:00
Subject: postgresql for sparc 2.5.1?
Previous:From: Jouni AhtoDate: 1998-08-24 16:47:21
Subject: Re: [INTERFACES] Convert PGconn, PGresult to opaque types?

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