Re: Password authentication working with psql, but fails with jdbc for me

From: "Nick Fankhauser" <nickf(at)ontko(dot)com>
To: "Gerald Dalley" <dalleyg(at)MIT(dot)EDU>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Password authentication working with psql, but fails with jdbc for me
Date: 2003-09-18 18:35:44
Message-ID: NEBBLAAHGLEEPCGOBHDGGEDJIHAA.nickf@ontko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Gerald-

Try connecting using psql with the -h option to specify the host (even if
you're on the same machine) this is a better test, since it will force psql
to connect using an IP socket in exactly the same fashion that jdbc does.
This will allow you to more definitely sort your problem into either "pg_hba
problem" or "java problem" groups.

-NF

> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Gerald Dalley
> Sent: Thursday, September 18, 2003 11:16 AM
> To: pgsql-jdbc(at)postgresql(dot)org
> Subject: [JDBC] Password authentication working with psql, but fails
> with jdbc for me
>
>
> I have setup a system with postgres 7.3.4-5 on Debian and am attempting to
> access a database from Java. When I use trust permissions, e.g.
> I have the
> following in my pg_hba.conf file:
> host all <theuser> <ip-range> <ip-mask> trust
> everything works fine (with values in angled brackets replaced as
> appropriate of course). I can access the database both through psql and
> with Java. If I modify pg_hba.conf to use any kind of password
> authentication (other than Kerberos, which isn't supported in the JDBC
> drivers), e.g. by using any one of the following lines
> host all <theuser> <ip-range> <ip-mask> password
> host all <theuser> <ip-range> <ip-mask> crypt
> host all <theuser> <ip-range> <ip-mask> md5
> then psql asks for a password and works properly, but I get the following
> error for the JDBC drivers:
> Password authentication failed for user "<theuser>"
> at org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection
> AbstractJdbc1Connection.java:202)
> at org.postgresql.Driver.connect(Driver.java:122)
>
> I get the same results from multiple machine with different JVMs and by
> trying out pg73jdbc1.jar, pg73jdbc2.jar, and pg73jdbc3.jar (by
> adding them,
> one at a time, to the classpath). In my postgresql.conf file, I do have
> "tcpip_socket=true".
>
> Most of the FAQs and discussions I've found on the topic point to
> classpath
> issues. As far as I can tell though, I'm using the classpath correctly
> since everything works fine in trust mode.
>
> Any ideas what I could be doing incorrectly?
>
> Thanks in advance.
>
> --Gerald Dalley
> dalleyg(at)mit(dot)edu
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Gerald Dalley 2003-09-18 20:33:52 Re: Password authentication working with psql, but fails with jdbc for me
Previous Message Paul Thomas 2003-09-18 17:45:58 Re: Password authentication working with psql, but fails with jdbc for me