jdk1.4.1 Password authentication failed for user. md5 support?
jdk1.4.1 Password authentication failed for user. md5 support?
От:
Aditya <aditya@grot.org>
Дата:
On a Solaris8 machine, with pgjdbc2.jar (downloaded yesterday from
jdbc.postgresql.org) I can get a simple test program to work fine with
a 1.2.2 JDK:
some:aditya~> /usr/java1.2/jre/bin/java -version
java version "1.2.2"
Solaris VM (build Solaris_JDK_1.2.2_05a, native threads, sunwjit)
however, running the exact same program with 1.4.1-beta:
some:aditya~> /usr/j2se/jre/bin/java -version
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
produces the following error (I'm using md5 passwords on the postgresql server):
Could not connect to db: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 "jndi"
Stack Trace:
java.sql.SQLException: FATAL 1: Password authentication failed for user "jndi"
at org.postgresql.Connection.openConnection(Connection.java:178)
at org.postgresql.Driver.connect(Driver.java:149)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at jdbcTest.main(jdbcTest.java:18)
End of Stack Trace
Exception in thread "main" java.lang.NullPointerException
at jdbcTest.main(jdbcTest.java:25)
and line 25 is indicated with a "==>" in the code fragment below:
Connection db = null;
try {
db = DriverManager.getConnection(url, username, password);
} catch (java.sql.SQLException e){
System.out.println("Could not connect to db:" + e.toString());
}
Statement st = null;
try {
==> st = db.createStatement();
} catch (java.sql.SQLException e){
System.out.println("Could not prepare statement:" + e.toString());
}
Looking through the archives, this doesn't seem to be a known problem.
Hints appreciated,
Thanks,
Adi
Re: jdk1.4.1 Password authentication failed for user. md5 support?
От:
Aditya <aditya@grot.org>
Дата:
> On Sat, 03 Aug 2002 10:50:07 -0700, Aditya said: > On a Solaris8 machine, with pgjdbc2.jar (downloaded yesterday from > jdbc.postgresql.org) I can get a simple test program to work fine > with a 1.2.2 JDK: > however, running the exact same program with 1.4.1-beta: > produces the following error (I'm using md5 passwords on the > postgresql server): > > Could not connect to db: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 "jndi" I changed the authentication type from md5 to trust in pg_hba.conf for that host, ie. was: host all 192.168.1.0 255.255.255.0 md5 and I prepended: host all 192.168.1.60 255.255.255.255 trust and it now works fine under 1.4.1-beta. So it looks like md5 auth isn't working for some reason...I've tried specifying digest=MD5 in the database URL like: jdbc:postgresql://192.168.1.103:5433/mydb?digest=MD5 to no avail. And adding user=foo;password=bar to the url in addition to specifying username and password as part of getConnection didn't work either... db = DriverManager.getConnection(url, username, password); Thanks, Adi