pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC Connection
4+ messages / 4 participants
[nested] [flat]

* JDBC Connection
@ 1998-08-24 12:14 Dr. Herrera <drherlams@diandel.com>
  1998-08-24 13:40 ` Re: [INTERFACES] JDBC Connection Eric Marsden <emarsden@mail.dotcom.fr>
  0 siblings, 1 reply; 4+ messages in thread

From: Dr. Herrera @ 1998-08-24 12:14 UTC (permalink / raw)
  To: pgsql-interfaces

Hello

	I am trying to connect to PostgreSQL from Java (JDK 1.1.6) under RedHat
Linux 5.1 using the JDBC interface. I have compiled the driver and tried to
run the examples this way:

java -Djdbc.drivers=postgresql.Driver example.basic jdbc:postgresql:prueba
postgres postgres

where 'prueba' is the name of an existing database.
But I always get a 'Connection refused' error in 
DriverManager.getConnection("jdbc:postgresql:prueba")

I have modified pg_hba.conf to allow any user on any host access to any
database
but the error still remains. 

Can anybody tell me what can be the problem and any possible solution?

					Thank you very much





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] JDBC Connection
  1998-08-24 12:14 JDBC Connection Dr. Herrera <drherlams@diandel.com>
@ 1998-08-24 13:40 ` Eric Marsden <emarsden@mail.dotcom.fr>
  1998-08-24 16:40   ` Re: [INTERFACES] JDBC Connection John Reilly <jr@broadcom.ie>
  1998-08-24 16:59   ` Re: [INTERFACES] JDBC Connection Peter T Mount <peter@retep.org.uk>
  0 siblings, 2 replies; 4+ messages in thread

From: Eric Marsden @ 1998-08-24 13:40 UTC (permalink / raw)
  To: Dr. Herrera <drherlams@diandel.com>; +Cc: pgsql-interfaces

>>>>> "DrH" == Herrera  <drherlams@diandel.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)?
Read the postmaster manual page for more details.  

-- 
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way down



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] JDBC Connection
  1998-08-24 12:14 JDBC Connection Dr. Herrera <drherlams@diandel.com>
  1998-08-24 13:40 ` Re: [INTERFACES] JDBC Connection Eric Marsden <emarsden@mail.dotcom.fr>
@ 1998-08-24 16:40   ` John Reilly <jr@broadcom.ie>
  1 sibling, 0 replies; 4+ messages in thread

From: John Reilly @ 1998-08-24 16:40 UTC (permalink / raw)
  To: Dr. Herrera <drherlams@diandel.com>; +Cc: pgsql-interfaces

Eric Marsden wrote:
> 
> >>>>> "DrH" == Herrera  <drherlams@diandel.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)?
> Read the postmaster manual page for more details.

Hi,
For RedHat5.1
edit  /etc/rc.d/init.d/postgresql  and add the -i parameter there.

     "su postgres -c '/usr/bin/postmaster -i -S -D/var/lib/pgsql'"

jr

-- 
-----------------------------------------------------------------------------
John Reilly,			|  Phone: +353 1 6046006
Broadcom Eireann Research Ltd.,	|  Fax:   +353 1 6761532
Kestrel House,			|  Email: jr@broadcom.ie
Clanwilliam Place,		|
Dublin 2,  Ireland		|
-----------------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [INTERFACES] JDBC Connection
  1998-08-24 12:14 JDBC Connection Dr. Herrera <drherlams@diandel.com>
  1998-08-24 13:40 ` Re: [INTERFACES] JDBC Connection Eric Marsden <emarsden@mail.dotcom.fr>
@ 1998-08-24 16:59   ` Peter T Mount <peter@retep.org.uk>
  1 sibling, 0 replies; 4+ messages in thread

From: Peter T Mount @ 1998-08-24 16:59 UTC (permalink / raw)
  To: Eric Marsden <emarsden@mail.dotcom.fr>; +Cc: Dr. Herrera <drherlams@diandel.com>; pgsql-interfaces

On 24 Aug 1998, Eric Marsden wrote:

> >>>>> "DrH" == Herrera  <drherlams@diandel.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@retep.org.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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~1998-08-24 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-08-24 12:14 JDBC Connection Dr. Herrera <drherlams@diandel.com>
1998-08-24 13:40 ` Eric Marsden <emarsden@mail.dotcom.fr>
1998-08-24 16:40   ` John Reilly <jr@broadcom.ie>
1998-08-24 16:59   ` Peter T Mount <peter@retep.org.uk>

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