Thread: jdbc interface problems with jdk1.2

jdbc interface problems with jdk1.2

From
Doug Thistlethwaite
Date:
Hello,

I have been trying to get a win95 system to connect to a postgresql
database on a linux system.

The linux system is a debian "potato" system with a 2.2.10 kernel.  The
version of postgresql is 6.5

I have installed posgresql, created a database "doug", created a user
"doug" and given the user a password.

The password file was created using the command pg_passwd
/var/postgresql/passwd

In the postmaster.init file I added
PGALLOWTCPIP=yes

and in the file pb_hba.conf I added the following line to the end of the
file

host         doug        IP.ADDRESS.OF PC 255.255.255.0  password
/var/postgres/passwd

When I try to run the example.basic example from the PC, I get the
following error message:

jC:\jdk1.2\DSNBrowse>java example.basic
jdbc:postgresql://dragon:5432/doug d
oug db
PostgreSQL basic test v6.3 rev 1

Starting constructor for basic
continueing constructor for basic
Connecting to Database URL = jdbc:postgresql://dragon:5432/doug
Exception caught.
Something unusual has occured to cause the driver to fail. Please report
this exception: java.sql.SQLException: Password authentication failed
for user 'doug'
Something unusual has occured to cause the driver to fail. Please report
this exception: java.sql.SQLException: Password authentication failed
for user 'doug'       at postgresql.Driver.connect(Driver.java:112)       at
java.sql.DriverManager.getConnection(CompiledCode)       at
java.sql.DriverManager.getConnection(DriverManager.java:137)      at example.basic.<init>(basic.java:34)       at
example.basic.main(basic.java:168)

Does anybody have an idea of what I can try to get this working?

Thanks,

Doug



Re: [INTERFACES] jdbc interface problems with jdk1.2

From
Tom Lane
Date:
Doug Thistlethwaite <doug.t@deltanet.com> writes:
> Password authentication failed for user 'doug'
>
> Does anybody have an idea of what I can try to get this working?

This tells you you are getting pretty far: you are making a TCP
connection, and the postmaster is recognizing that the entry for
your IP address in pg_hba demands password authentication.  So,
either you are supplying the wrong password from the client end,
or something's wrong with the password file.

There might be more info in the postmaster log file than is reported
to the client --- did you look there?

One potential typo stands out in your message:

> The password file was created using the command pg_passwd
> /var/postgresql/passwd      ^^^^^^^^^^
> host         doug        IP.ADDRESS.OF PC 255.255.255.0  password
> /var/postgres/passwd      ^^^^^^^^

Prolly that's just a transcription error in your message, but if
it's real...
        regards, tom lane


Re: [INTERFACES] jdbc interface problems with jdk1.2

From
Doug Thistlethwaite
Date:
Yes, that was a typo on my part.  I also found out that the MASK should
be 255.255.255.255 if I want only the single system to access my
database...  But that did not fix the problem either.

Any more suggestions would be appriciated!

Doug

Tom Lane wrote:

> Doug Thistlethwaite <doug.t@deltanet.com> writes:
> > Password authentication failed for user 'doug'
> >
> > Does anybody have an idea of what I can try to get this working?
>
> This tells you you are getting pretty far: you are making a TCP
> connection, and the postmaster is recognizing that the entry for
> your IP address in pg_hba demands password authentication.  So,
> either you are supplying the wrong password from the client end,
> or something's wrong with the password file.
>
> There might be more info in the postmaster log file than is reported
> to the client --- did you look there?
>
> One potential typo stands out in your message:
>
> > The password file was created using the command pg_passwd
> > /var/postgresql/passwd
>        ^^^^^^^^^^
> > host         doug        IP.ADDRESS.OF PC 255.255.255.0  password
> > /var/postgres/passwd
>        ^^^^^^^^
>
> Prolly that's just a transcription error in your message, but if
> it's real...
>
>                         regards, tom lane