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

From: Eric Tan <neltan2002(at)yahoo(dot)com(dot)hk>
To: Eric Tan <neltan2002(at)yahoo(dot)com(dot)hk>, Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: How to insert Chinese (big5) through JDBC?
Date: 2003-07-31 07:26:45
Message-ID: 20030731072645.64862.qmail@web13006.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,
I can now insert Chinese!!
I'm now using EUC_TW as the database encoding.
However, the default client encoding is now EUC_TW. (that's why I cannot insert Chinese). I have to exe "set client_encoding to 'Big5';" when inserting and selecting.

Can I set Big5 as the default client_encoding ?

Best Regards,
Eric Tan

Eric Tan <neltan2002(at)yahoo(dot)com(dot)hk> wrote:
Hi Kris Jurka,

When initializing the data, I can move the big5 data from MSSQL7 and insert into the postgresql database through VB. Why?

Another case: I write the insert statement to the debug file. I can read the Chinese there. If I copy and paste in "putty", I can also insert those Chinese correctly.

Thus, I guess the problem is inserting through JDBC.

Best Regards,
Eric Tan

Kris Jurka <books(at)ejurka(dot)com> wrote:

On Wed, 30 Jul 2003, [big5] Eric Tan wrote:

> Hi all,
> I encounter problem when inserting Chinese.
> These are my setting:
> - postgresql 7.3 (database encoding: "SQL_ASCII")
> - JDBC: pg73jdbc2.jar
> - Tomcat 4.1.24
> - JSP/Servlet/Java Bean
> insert into table1 values('&curren;@&curren;G&curren;T') // chinese cannot display here...
> Insert Chinese words are ok. But when I select the record, there were wrong sth. like '? ?&sup3;&aelig; '
> The sql statement is in big5 format because I write it in a log file.
> I've tried using charset like this. Not knowing why. All fail...
> jdbc:postgresql://202.71.201.252:5432/CA_care?charSet=ISO-8859-1
> jdbc:postgresql://202.71.201.252:5432/CA_care?charSet=SQL_ASCII
> jdbc:postgresql://202.71.201.252:5432/CA_care?charSet=UTF-8
> jdbc:postgresql://202.71.201.252:5432/CA_care?charSet=Big5
>
> Any idea.
> Best Regards,
> Eric Tan

You cannot store Big5 data in a SQL_ASCII encoded database. Consider
using UNICODE. Also the ?charset=xxx argument in the database URL is no
longer valid in the Postgresql JDBC drivers starting with 7.3.

Kris Jurka

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

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2003-07-31 08:07:21 Re: unsubscribe
Previous Message Arun Desai 2003-07-31 04:59:06 unsubscribe