Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 956E3633320 for ; Tue, 20 Apr 2010 22:20:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 55478-10 for ; Wed, 21 Apr 2010 01:20:14 +0000 (UTC) X-Greylist: delayed 00:07:52.39866 by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id EF25A6332DA for ; Tue, 20 Apr 2010 22:20:30 -0300 (ADT) Received: from [192.168.157.32] (unknown [216.129.226.69]) by outbound.vnet-inc.com (Postfix) with ESMTP id 081225C88; Tue, 20 Apr 2010 19:12:37 -0600 (MDT) Message-ID: <4BCE507D.3060906@ttc-cmc.net> Date: Tue, 20 Apr 2010 19:10:21 -0600 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060417 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shivenderd@gmail.com, pgsql-jdbc@postgresql.org Subject: Re: Authentication failed when Password contains Japaneese Charecters References: <8844.1271809392@sss.pgh.pa.us> In-Reply-To: <8844.1271809392@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.75 tagged_above=-10 required=5 tests=AWL=0.150, BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/45 X-Sequence-Number: 20456 > > >Shivender Devarakonda writes: > > >>> I am using Postgres SQL version 8.3 server and I have a client that uses >>> Postgres SQL JDBC driver. I have a user "admin" with the password having >>> japaneese charecters 形式. >> >> > >Just a guess, but I suspect it's an encoding issue. I expect JDBC would >send the password in utf8 encoding. Maybe you defined the password in >a session that was using a different encoding? > > regards, tom lane > > > Encoding I think is the best guess, but I did have a password that worked perfectly well with psql but failed in the application using the JDBC. I finally tracked it down to a special escape sequence character, %, in the password string created by a user. You could check to make sure one of your character encodings does not translate to one of these special characters. Solution finally was to translate the character to a hexadecimal value. Code follows: // MySQL, PostgreSQL, & HSQL else { // The % character is interpreted as the start of a special escaped sequence, // two digit hexadeciaml value. So replace passwordString characters with that // character with that characters hexadecimal value as sequence, %37. Java // API URLDecoder. passwordString = passwordString.replaceAll("%", "%" + Integer.toHexString(37)); connectionProperties += subProtocol + "://" + host + ":" + port + "/" + db + "?user=" + user + "&password=" + passwordString + "&useSSL=" + ssh; // System.out.println(connectionProperties); dbConnection = DriverManager.getConnection(connectionProperties) } danap.