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

JDBC connection refused

From: John Collins <jcollins(at)cs(dot)umn(dot)edu>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: JDBC connection refused
Date: 2000-03-03 15:16:51
Message-ID: 38BFD763.89351A86@cs.umn.edu (view raw or flat)
Thread:
Lists: pgsql-interfaces
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




Responses

pgsql-interfaces by date

Next:From: Ed LoehrDate: 2000-03-03 15:48:34
Subject: Re: [INTERFACES] Quick perl question
Previous:From: Emmanuel DISCORSDate: 2000-03-03 13:59:30
Subject: Re: [GENERAL] Postgres on MacOS... Is it even a possibility?

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