Re: md5 passwords in 7.2.3 ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rasputin <rasputin(at)idoru(dot)mine(dot)nu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: md5 passwords in 7.2.3 ?
Date: 2002-12-01 19:46:58
Message-ID: 200212011946.gB1Jkws28045@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


You need a newer jdbc driver from jdbd.postgresql.org. It will work
with 7.2.3.

---------------------------------------------------------------------------

Rasputin wrote:
>
> Just a quick check - are these supposed to work?
>
> I'm running PostgreSQL 7.2.3 and connecting remotely - psql
> seems to handle MD5 password auth (as specified in g_hba.conf) transparently,
> but a very simple java app craps out :
>
> --------------------------------------
> import java.sql.*;
>
> public class simpletest {
>
> public static void main(String args[]) {
>
> if ( args.length != 4 ) { usage(); }
> try {
> simpletest me = new simpletest();
> me.connect(args);
> } catch (Exception e) { e.printStackTrace(); }
> }
>
> public simpletest(){}
>
> private void connect(String args[]) {
>
> try {
> Class.forName("org.postgresql.Driver");
> } catch (ClassNotFoundException c) {
> c.printStackTrace();
> }
>
> String user = args[0]; String pass = args[1];
> String host = args[2]; String db = args[3];
>
> String url = "jdbc:postgresql://" + host + "/" + db;
>
> try {
> Connection con = DriverManager.getConnection(url, user, pass);
> } catch (SQLException s) {
> s.printStackTrace();
> }
>
> }
>
> private static void usage() {
> System.err.println("usage\nsimpletest user pass host db");
> System.exit(0);
> }
> }
> --------------------------------------
>
> Runing
> java simpletest user pass host db
> <names changed to protect the innocent>
> gives me this error:
>
> --------------------------------------
> Something unusual has occured to cause the driver to fail. Please report this exception: Exception: java.sql.SQLException: FATAL 1: Password authentication failed for user "user"
>
> Stack Trace:
>
> java.sql.SQLException: FATAL 1: Password authentication failed for user "user"
>
> at org.postgresql.Connection.openConnection(Unknown Source)
> at org.postgresql.Driver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
> at simpletest.connect(simpletest.java:38)
> at simpletest.main(simpletest.java:14)
> End of Stack Trace
>
> at org.postgresql.Driver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
> at simpletest.connect(simpletest.java:38)
> at simpletest.main(simpletest.java:14)
> --------------------------------------
>
> BUT it works (i.e. java exits without errors) if I setup another db
> with a plaintext password in pg_shadow, so it seems related to MD5 .
>
> Am I missing a step somewhere?
> >From a quick glance at the driver source, I think the driver
> should be informed what password encoding to use by the server - in which case, I
> wouldn't have thought the client *could* specify an encoding scheme.
>
> I did check the archives and FAQ before posting, but couldn't tell if this was still
> an issue...
>
>
>
> --
> Rasputin :: Jack of All Trades - Master of Nuns
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mariusz Wiktorczyk 2002-12-01 23:12:50 Measuring time of select query
Previous Message Rasputin 2002-12-01 15:04:27 md5 passwords in 7.2.3 ?