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

RE: [INTERFACES] JDBC connection refused

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: "'John Collins'" <jcollins(at)cs(dot)umn(dot)edu>, pgsql-interfaces(at)postgresql(dot)org
Subject: RE: [INTERFACES] JDBC connection refused
Date: 2000-03-03 16:07:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
The "Connection Refused" message is actually coming from the TCP/IP
stack, rather than Java or JDBC. It's caused by nothing actually
listening on the remote socket.

With postgresql, this indicates that you haven't started the postmaster
with the -i flag, which enables the IP socket.


Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.

-----Original Message-----
From: John Collins [mailto:jcollins(at)cs(dot)umn(dot)edu]
Sent: Friday, March 03, 2000 3:17 PM
To: pgsql-interfaces(at)postgreSQL(dot)org
Subject: [INTERFACES] JDBC connection refused

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 {
      Connection con =
          "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
 at postgresql.Connection.openConnection(, Compiled Code)

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

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

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

John Collins
University of Minnesota


pgsql-interfaces by date

Next:From: Lamar OwenDate: 2000-03-03 16:29:23
Subject: Re: [INTERFACES] JDBC connection refused
Previous:From: Ed LoehrDate: 2000-03-03 15:59:55
Subject: Re: [INTERFACES] Pgaccess - Error trying to connect

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