pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedAuthentication failed when Password contains Japaneese Charecters
15+ messages / 5 participants
[nested] [flat]
* Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 00:11 Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 00:11 UTC (permalink / raw)
To: pgsql-jdbc
Hi all,
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 形式.
Step -1 I used psql client to connect to the Database and it was successful
and I am able to see the tables.
Ste-2 Our application uses the JDBC driver to connect to the Database. I see
that the password is correctly passed to the
class: org.postgresql.core.v3.ConnectionFactoryImpl
method:doAuthentication
The first statement there
String password = info.getProperty("password");
returning the "japaneese charecters that I passed.
after that control is going to *
case* *AUTH_REQ_PASSWORD*: block after it flushes the password I see that
exception is coming.
I see the following log statement in the postgres logs:
[64276-[unknown]-[unknown]-2010-04-20 17:07:56.157 PDT]LOG: connection
received: host=138.42.220.183 port=2634
[64276-cemdb-admin-2010-04-20 17:07:56.157 PDT]FATAL: password
authentication failed for user "admin"
we use the following JDBC Driver: postgresql-8.4-701.jdbc4.jar
I am not sure why we do not see any problem with psql but we see the problem
with JDBC drivers.
Please assist me on this.
Thanks,
Shivender
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 00:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 2 replies; 15+ messages in thread
From: Tom Lane @ 2010-04-21 00:23 UTC (permalink / raw)
To: Shivender Devarakonda <shivenderd@gmail.com>; +Cc: pgsql-jdbc
Shivender Devarakonda <shivenderd@gmail.com> 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
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 00:29 Shivender Devarakonda <shivenderd@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 00:29 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
I explicitly changed the property file.encoding to UTF-8 before I run my
application. I am sure application is sending the password in UTF-8 byte
array[]. Are you talking about server session?
Thanks,
Shivender
On Tue, Apr 20, 2010 at 5:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Shivender Devarakonda <shivenderd@gmail.com> 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
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 00:35 Shivender Devarakonda <shivenderd@gmail.com>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 00:35 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
I did not give any explicit encoding while creating the DB. I am running
postgres on Windows XP system.
Thanks for looking in to this.
Regards,
Shivender
On Tue, Apr 20, 2010 at 5:29 PM, Shivender Devarakonda <shivenderd@gmail.com
> wrote:
> I explicitly changed the property file.encoding to UTF-8 before I run my
> application. I am sure application is sending the password in UTF-8 byte
> array[]. Are you talking about server session?
>
> Thanks,
> Shivender
>
> On Tue, Apr 20, 2010 at 5:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> Shivender Devarakonda <shivenderd@gmail.com> 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
>>
>
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 01:10 dmp <danap@ttc-cmc.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 15+ messages in thread
From: dmp @ 2010-04-21 01:10 UTC (permalink / raw)
To: shivenderd@gmail.com; pgsql-jdbc
>
>
>Shivender Devarakonda <shivenderd@gmail.com> 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.
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 01:18 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2010-04-21 01:18 UTC (permalink / raw)
To: Shivender Devarakonda <shivenderd@gmail.com>; +Cc: pgsql-jdbc
Shivender Devarakonda <shivenderd@gmail.com> writes:
> I did not give any explicit encoding while creating the DB. I am running
> postgres on Windows XP system.
Well, you should look at what server_encoding is set to, then.
If it's not UTF-8 then that's likely the source of the problem.
regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 02:07 Shivender Devarakonda <shivenderd@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 02:07 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
Thanks. Where should I look for this property?
Thanks,
Shivender
On Tue, Apr 20, 2010 at 6:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Shivender Devarakonda <shivenderd@gmail.com> writes:
> > I did not give any explicit encoding while creating the DB. I am running
> > postgres on Windows XP system.
>
> Well, you should look at what server_encoding is set to, then.
> If it's not UTF-8 then that's likely the source of the problem.
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 02:23 Shivender Devarakonda <shivenderd@gmail.com>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 2 replies; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 02:23 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
When I did the psql -l I see the following DBs in my local environment:
C:\PostgreSQL\bin>psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
cmdb | admin | UTF8
postgres | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
I am using cmdb which is UTF8.
I think it is consistent with my application? any thoughts what might be
wrong.
Thanks,
Shivender
On Tue, Apr 20, 2010 at 7:07 PM, Shivender Devarakonda <shivenderd@gmail.com
> wrote:
> Thanks. Where should I look for this property?
>
> Thanks,
> Shivender
>
>
>
>
> On Tue, Apr 20, 2010 at 6:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> Shivender Devarakonda <shivenderd@gmail.com> writes:
>> > I did not give any explicit encoding while creating the DB. I am running
>> > postgres on Windows XP system.
>>
>> Well, you should look at what server_encoding is set to, then.
>> If it's not UTF-8 then that's likely the source of the problem.
>>
>> regards, tom lane
>>
>
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 03:49 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shivender Devarakonda <shivenderd@gmail.com>
1 sibling, 1 reply; 15+ messages in thread
From: Tom Lane @ 2010-04-21 03:49 UTC (permalink / raw)
To: Shivender Devarakonda <shivenderd@gmail.com>; +Cc: pgsql-jdbc
Shivender Devarakonda <shivenderd@gmail.com> writes:
> When I did the psql -l I see the following DBs in my local environment:
> C:\PostgreSQL\bin>psql -l
> List of databases
> Name | Owner | Encoding
> -----------+----------+-----------
> cmdb | admin | UTF8
> postgres | postgres | SQL_ASCII
> template0 | postgres | SQL_ASCII
> template1 | postgres | SQL_ASCII
> I am using cmdb which is UTF8.
Hmm, but which database did you connect to when you set the user's
password?
regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 03:59 Shivenderd <shivenderd@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 15+ messages in thread
From: Shivenderd @ 2010-04-21 03:59 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc
I connect to cmdb
-Shivender
Sent from my iPhone
On Apr 20, 2010, at 8:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Shivender Devarakonda <shivenderd@gmail.com> writes:
>> When I did the psql -l I see the following DBs in my local
>> environment:
>> C:\PostgreSQL\bin>psql -l
>> List of databases
>> Name | Owner | Encoding
>> -----------+----------+-----------
>> cmdb | admin | UTF8
>> postgres | postgres | SQL_ASCII
>> template0 | postgres | SQL_ASCII
>> template1 | postgres | SQL_ASCII
>
>> I am using cmdb which is UTF8.
>
> Hmm, but which database did you connect to when you set the user's
> password?
>
> regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 04:10 Ader Javier <javierader@gmail.com>
parent: Shivender Devarakonda <shivenderd@gmail.com>
1 sibling, 1 reply; 15+ messages in thread
From: Ader Javier @ 2010-04-21 04:10 UTC (permalink / raw)
To: pgsql-jdbc
Try change the encoding of sesssions at database nivel to UTF8; this
encoding is taked as default for sessions
http://www.postgresql.org/docs/8.1/static/sql-alterdatabase.html ; try
ALTER DATABASE databasename SET ENCODING TO 'UTF8'
(or maybe UFT8 directly).
or if this don't work try
ALTER DATABASE databasename SET client_encoding TO 'UTF8'
or.... from Java set the econding of connections on creation or
configuration time (I don't know where exactly, but sure it's possible).
Shivender Devarakonda escribió:
>
> When I did the psql -l I see the following DBs in my local environment:
>
> C:\PostgreSQL\bin>psql -l
> List of databases
> Name | Owner | Encoding
> -----------+----------+-----------
> cmdb | admin | UTF8
> postgres | postgres | SQL_ASCII
> template0 | postgres | SQL_ASCII
> template1 | postgres | SQL_ASCII
>
> I am using cmdb which is UTF8.
>
> I think it is consistent with my application? any thoughts what might
> be wrong.
>
> Thanks,
> Shivender
> On Tue, Apr 20, 2010 at 7:07 PM, Shivender Devarakonda
> <shivenderd@gmail.com <mailto:shivenderd@gmail.com>> wrote:
>
> Thanks. Where should I look for this property?
>
> Thanks,
> Shivender
>
>
>
>
> On Tue, Apr 20, 2010 at 6:18 PM, Tom Lane <tgl@sss.pgh.pa.us
> <mailto:tgl@sss.pgh.pa.us>> wrote:
>
> Shivender Devarakonda <shivenderd@gmail.com
> <mailto:shivenderd@gmail.com>> writes:
> > I did not give any explicit encoding while creating the DB.
> I am running
> > postgres on Windows XP system.
>
> Well, you should look at what server_encoding is set to, then.
> If it's not UTF-8 then that's likely the source of the problem.
>
> regards, tom lane
>
>
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 05:44 Shivender Devarakonda <shivenderd@gmail.com>
parent: Ader Javier <javierader@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 05:44 UTC (permalink / raw)
To: Ader Javier <javierader@gmail.com>; +Cc: pgsql-jdbc
I set the following property in postgresql.conf:
client_encoding = UTF-8 # actually, defaults to database
# encoding
I see the same problem after this also...
actaully my DB already shows the encoding format as UTF-8 so according to
the comments the client encoding should default to UTF-8.
Please let me know if I miss anything
Thanks,
Shivender
On Tue, Apr 20, 2010 at 9:10 PM, Ader Javier <javierader@gmail.com> wrote:
> Try change the encoding of sesssions at database nivel to UTF8; this
> encoding is taked as default for sessions
> http://www.postgresql.org/docs/8.1/static/sql-alterdatabase.html ; try
> ALTER DATABASE databasename SET ENCODING TO 'UTF8'
> (or maybe UFT8 directly).
> or if this don't work try
> ALTER DATABASE databasename SET client_encoding TO 'UTF8'
> or.... from Java set the econding of connections on creation or
> configuration time (I don't know where exactly, but sure it's possible).
>
> Shivender Devarakonda escribió:
> >
> > When I did the psql -l I see the following DBs in my local environment:
> >
> > C:\PostgreSQL\bin>psql -l
> > List of databases
> > Name | Owner | Encoding
> > -----------+----------+-----------
> > cmdb | admin | UTF8
> > postgres | postgres | SQL_ASCII
> > template0 | postgres | SQL_ASCII
> > template1 | postgres | SQL_ASCII
> >
> > I am using cmdb which is UTF8.
> >
> > I think it is consistent with my application? any thoughts what might
> > be wrong.
> >
> > Thanks,
> > Shivender
> > On Tue, Apr 20, 2010 at 7:07 PM, Shivender Devarakonda
> > <shivenderd@gmail.com <mailto:shivenderd@gmail.com>> wrote:
> >
> > Thanks. Where should I look for this property?
> >
> > Thanks,
> > Shivender
> >
> >
> >
> >
> > On Tue, Apr 20, 2010 at 6:18 PM, Tom Lane <tgl@sss.pgh.pa.us
> > <mailto:tgl@sss.pgh.pa.us>> wrote:
> >
> > Shivender Devarakonda <shivenderd@gmail.com
> > <mailto:shivenderd@gmail.com>> writes:
> > > I did not give any explicit encoding while creating the DB.
> > I am running
> > > postgres on Windows XP system.
> >
> > Well, you should look at what server_encoding is set to, then.
> > If it's not UTF-8 then that's likely the source of the problem.
> >
> > regards, tom lane
> >
> >
> >
>
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 14:58 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Tom Lane @ 2010-04-21 14:58 UTC (permalink / raw)
To: Shivender Devarakonda <shivenderd@gmail.com>; +Cc: Ader Javier <javierader@gmail.com>; pgsql-jdbc
Shivender Devarakonda <shivenderd@gmail.com> writes:
> I set the following property in postgresql.conf:
> client_encoding = UTF-8 # actually, defaults to database
That would not help if you were connecting to a database with SQL_ASCII
encoding (which defeats all encoding intelligence). I'd suggest
connecting to cmdb with psql and issuing an ALTER USER command to
set the user's password again.
regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 16:18 Shivender Devarakonda <shivenderd@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 15+ messages in thread
From: Shivender Devarakonda @ 2010-04-21 16:18 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Ader Javier <javierader@gmail.com>; pgsql-jdbc
I did not get you on this. My DB cmdb is in UTF-8 already, do I still need
to change the password and test it?
I tried to use ALTER USER to change the password, for some reason the sql
command is not displaying the japaneese charecter properly and I tried using
the buffer file but the buffer file was default to ANSI format and it is not
accepting UTF-8 format..
any thoughts?
Thanks,
Shivender
On Wed, Apr 21, 2010 at 7:58 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Shivender Devarakonda <shivenderd@gmail.com> writes:
> > I set the following property in postgresql.conf:
> > client_encoding = UTF-8 # actually, defaults to database
>
> That would not help if you were connecting to a database with SQL_ASCII
> encoding (which defeats all encoding intelligence). I'd suggest
> connecting to cmdb with psql and issuing an ALTER USER command to
> set the user's password again.
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 15+ messages in thread
* Re: Authentication failed when Password contains Japaneese Charecters
@ 2010-04-21 16:41 Tom Lane <tgl@sss.pgh.pa.us>
parent: Shivender Devarakonda <shivenderd@gmail.com>
0 siblings, 0 replies; 15+ messages in thread
From: Tom Lane @ 2010-04-21 16:41 UTC (permalink / raw)
To: Shivender Devarakonda <shivenderd@gmail.com>; +Cc: Ader Javier <javierader@gmail.com>; pgsql-jdbc
Shivender Devarakonda <shivenderd@gmail.com> writes:
> I tried to use ALTER USER to change the password, for some reason the sql
> command is not displaying the japaneese charecter properly and I tried using
> the buffer file but the buffer file was default to ANSI format and it is not
> accepting UTF-8 format..
Well, that's sure consistent with the idea that you've got encoding
conversion issues going on. I don't know enough about encoding behavior
on Windows to help you much more with that. The path of least
resistance might be to use a plain-ASCII password.
regards, tom lane
^ permalink raw reply [nested|flat] 15+ messages in thread
end of thread, other threads:[~2010-04-21 16:41 UTC | newest]
Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21 00:11 Authentication failed when Password contains Japaneese Charecters Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 00:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-04-21 00:29 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 00:35 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 01:18 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-04-21 02:07 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 02:23 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 03:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-04-21 03:59 ` Shivenderd <shivenderd@gmail.com>
2010-04-21 04:10 ` Ader Javier <javierader@gmail.com>
2010-04-21 05:44 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 14:58 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-04-21 16:18 ` Shivender Devarakonda <shivenderd@gmail.com>
2010-04-21 16:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-04-21 01:10 ` dmp <danap@ttc-cmc.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox