Re: A JDBC bug or problem relating to string length in Java

Поиск
Список
Период
Сортировка
От joe user
Тема Re: A JDBC bug or problem relating to string length in Java
Дата
Msg-id 20030903211812.44426.qmail@web20405.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: A JDBC bug or problem relating to string length in Java  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
> SELECT datname,pg_encoding_to_char(encoding) FROM
> pg_database;

Thanks for the suggestion Kris.  I also got some help
from Barry.  The problem is that the encoding in the
db was ascii, which causes a discrepency between Java
string lengths and the string lengths in the db.  The
solution is to drop and recreate the db using unicode
encoding.

One conclusion from this is that, as a Java developer,
unless you are absolutely sure that all the strings
you are dealing with really are ascii, you should be
sure that the db has unicode encoding.  Java does not
internally use ascii for anything.  Everything in Java
is UTF-16, so external storage that Java uses should
be able to represent the full range of UTF characters.
 I think this would make a good entry in the JDBC FAQ:
"Always use Unicode encoding when using the JDBC
unless you are sure that you are only dealing with
ASCII."

Thanks


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Nicolas Modrzyk
Дата:
Сообщение: Postgresql java and blobs
Следующее
От: Zak McGregor
Дата:
Сообщение: Threadsafe from which version?