Re: [INTERFACES] Can't connect to Postgres with JDBC

From: Peter T Mount <pgint(at)maidast(dot)demon(dot)co(dot)uk>
To: Brian Cross <bscross(at)us(dot)ibm(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] Can't connect to Postgres with JDBC
Date: 1998-01-20 22:26:59
Message-ID: Pine.LNX.3.95.980120221725.28484A-100000@maidast
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Mon, 19 Jan 1998, Brian Cross wrote:

> Hi,
>
> I'm trying to connect to my postgres database(that came with
> RedHat 5.0) with an applet using JDBC. The driver seems to be loading
> fine, but I receive this error when starting the applet:
>
> java.sql.SQLException: Failed to authenticate client as Postgres user
> 'bscross' using the default authentication type: be_recvauth: host-based
> authentication failed.
>
> The bscross user is both a system user and one I created in postgres.
> Do I need to change the authentication type, and if so what does it
> need to be?
>
> I have read every FAQ and HOWTO I could find with no luck. I would be
> forever in debt if someone could help me out with this. Thanks!

Ok, there are three things that can stop an applet from connecting, and
you have hit the one which affects all clients, not just jdbc.

The file $PGDATA/pg_hba.conf contains a list of hosts that are allowed
access to any database. What is happening is that your web browser is
attempting to access the database from an ip address/mask not defined in
that file. Full instructions are included inside the file.

The other two are where the applet is downloaded from one host, and the
database is on another. This is not possible, and throws a
SecurityException.

The third one is where the browser doesn't support JDK 1.1

Anyhow, when it says about "Host based authentication", the first place to
look in is pg_hba.conf

PS: Another test is (if you are running the applet from the same machine
as the database), to try the url with both your hostname, and localhost.
I'd bet you are using your host name, and it works with localhost. If so,
then pg_hba.conf is where your problem is.

--
Peter T Mount petermount(at)earthling(dot)net or pmount(at)maidast(dot)demon(dot)co(dot)uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter(at)maidstone(dot)gov(dot)uk

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message lothar 1998-01-20 23:51:09 (no subject)
Previous Message Brian Cross 1998-01-19 18:15:37 Can't connect to Postgres with JDBC