Re: About a JDBC error

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: zhang-x(at)cnt(dot)mxy(dot)nes(dot)nec(dot)co(dot)jp
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: About a JDBC error
Date: 2004-04-09 05:38:33
Message-ID: 407636D9.9080005@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

zhang-x(at)cnt(dot)mxy(dot)nes(dot)nec(dot)co(dot)jp wrote:
> Hi all,
>
> I have got this error.
> How can I do with this error?
> I have no idea.

What version of the driver are you using? I see this in the CVS logs:

> ----------------------------
> revision 1.31
> date: 2004/02/10 01:56:46; author: jurka; state: Exp; lines: +14 -6
> Don't try to turn the random bytes from a md5 salt into a String
> because it may not be a valid String depending on the encoding.
>
> Per report from Nadeem Bitar.
> ----------------------------

so if your driver is older than that, it may be the problem.

Failing that, are you using crypt-based authentication? ("crypt" in the
appropriate access line in pg_hba.conf). From a quick glance at the code
it looks like the crypt salt suffers from the same problem as md5 used
to -- it tries to turn a couple of bytes into a String using the default
encoding, which will not work reliably. As a temporary workaround, try
changing pg_hba.conf to use "md5" instead of "crypt".

If you use a different default encoding such as ISO-8859-1 (IIRC you can
do this by setting the file.encoding system property, i.e.
-Dfile.encoding=ISO-8859-1) does the problem go away?

> ----------------err----------------------
> DBAccess.getConnection(): Something unusual has occured to cause the driver
> to fail. Please report this exception: Exception:
> java.lang.IllegalArgumentException
> Stack Trace:
>
> java.lang.IllegalArgumentException
> at java.nio.Buffer.position(Buffer.java:218)
> at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:575)
> at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:186)
> at java.lang.StringCoding.decode(StringCoding.java:224)
> at java.lang.StringCoding.decode(StringCoding.java:230)
> at java.lang.String.<init>(String.java:371)
> at
> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnectionV2(AbstractJdbc1C
> onnection.java:634)

-O

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message zhang-x 2004-04-09 06:00:20 Re: About a JDBC error
Previous Message Andrew Lazarus 2004-04-09 04:33:19 Re: Visual tools