Re: How to insert Chinese (big5) through JDBC?

Поиск
Список
Период
Сортировка
От Eric Tan
Тема Re: How to insert Chinese (big5) through JDBC?
Дата
Msg-id 20030801012043.59182.qmail@web13004.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: How to insert Chinese (big5) through JDBC?  (Kris Jurka <books@ejurka.com>)
Ответы Re: How to insert Chinese (big5) through JDBC?
Список pgsql-jdbc
I guess it was. I doesn't.
CA_care=# SELECT datconfig FROM pg_database WHERE datname='CA_care';
       datconfig
------------------------
 {client_encoding=Big5}
CA_care=# \encoding
EUC_TW
 
When I select fields with Chinese content in jsp, it cannot display correctly, unless I add this:
pgsql.execute("set client_encoding to 'Big5';");
and get it
pgsql.getChinese2("receivedfrom")

** "pgsql" is the java bean handling resultset
 
Best Regards,
  Eric Tan

Kris Jurka <books@ejurka.com> wrote:


On Thu, 31 Jul 2003, [big5] Eric Tan wrote:

> The command only work in command prompt - putty":
> ALTER DATABASE "CA_care" SET client_enconding TO 'big5';
>
> But it fail when inserting from jsp & VB.
> I have to run this code in all program which may access database.
> pgsql.execute("set client_encoding to 'Big5';");
>
> Any other solution?

The idea is that you run the ALTER DATABASE command once and then every
time you connect it will already be set, so you do not need to make that
call in your client. Notice the second time I connect the client_encoding
is already set.

jurka@doug:~$ psql tantest
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or te rminate with semicolon to execute query
\q to quit

tantest=# show client_encoding;
client_encoding
-----------------
SQL_ASCII
(1 row)

tantest=# alter database tantest set client_encoding to big5;
ALTER DATABASE
tantest=# \q
jurka@doug:~$ psql tantest
Welcome to psql 7.3.3, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

tantest=# show client_encoding;
client_encoding
-----------------
big5
(1 row)



To check if you have correctly run the ALTER DATABASE statement, check

SELECT datconfig FROM pg_database WHERE datname='';

You should see
tantest=# select datconfig FROM pg_database where datname='tantest';
datconfig
------------------------
{client_encoding=big5}
(1 row)


Kris Jurka

最新鈴聲推介:十面埋伏,多謝失戀,心淡...
http://ringtone.yahoo.com.hk

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

Предыдущее
От: "Jason Sando"
Дата:
Сообщение: No function escape processing?
Следующее
От: "Jason Sando"
Дата:
Сообщение: Allow Byte type in Statement.setObject (v7.3.4)