pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Collins <jcollins@cs.umn.edu>
To: pgsql-interfaces@postgresql.org
Subject: JDBC connection refused
Date: Fri, 03 Mar 2000 09:16:51 -0600
Message-ID: <38BFD763.89351A86@cs.umn.edu> (raw)

I have Postgresql set up on RedHat 6.1, and I can access it with jdbc or
pgaccess locally, and with pgaccess from another linux box on the same
local net.  However, I can't get a connection with jdbc across the net.
The relevant code is

  public static void main (String[] args) {
    try {
      Class.forName("postgresql.Driver");
      Connection con =
   DriverManager.getConnection("jdbc:postgresql://birch/auction",
          "collins", "");
      // Do something useful here
      Statement stmt = con.createStatement();
    ....

and the error message is

Connection refused. Check that the hostname and port is correct, and
that the postmaster is running with the -i flag, which enables TCP/IP
networking.
 at postgresql.Connection.openConnection(Connection.java, Compiled Code)

 at postgresql.Driver.connect(Driver.java, Compiled Code)
 at java.sql.DriverManager.getConnection(DriverManager.java, Compiled
Code)
 ....

Here's what I've checked:
 - postmaster is indeed being run with the -i flag.  I think neither the
local jdbc or the remote pgaccess would work otherwise.  Here's the line
from rc.d/init.d/postgres:
       su -l postgres -c '/usr/bin/postmaster -i -S -D/var/lib/pgsql'
 - I've used every name I can think of, including the ip address, in the
URL above.  I've used the port and I've not used the port.
 - I've used netstat to check that postmaster is indeed listening on
5432

I'm stumped.  Thanks in advance for any assistance.

John Collins
University of Minnesota






view thread (12+ messages)  latest in thread

Message-ID: <38BFD763.89351A86@cs.umn.edu>
Permalink:  ../38BFD763.89351A86@cs.umn.edu/
Also on:    postgresql.org/message-id/38BFD763.89351A86@cs.umn.edu

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jcollins@cs.umn.edu
  Subject: Re: JDBC connection refused
  In-Reply-To: <38BFD763.89351A86@cs.umn.edu>

* 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