You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Ben Ng <cn...@gmail.com> on 2011/11/07 02:34:01 UTC
Re: Inserting Chinese character record to DB
Hi Empire-DB team,
I am trying to insert a record with Chinese character from my JSP page.
The encoding is set to UTF-8 already and I am trying to insert the
record by the code below where "remarks" is a string contain Chinese
characters.
DBRecord rec = new DBRecord();
rec.create(db.REQUESTS);
rec.setValue(db.REQUESTS.REMARKS, remarks);
rec.update(conn);
After inserting the record, the data of the field REMARKS become "???".
I tried to use traditional method(PreparedStatement) to insert this
record by using the same db and connection.
The data can be inserted correctly.
Is there any step I have missed in my code so it can support UTF-8?
I really appreciate for what your team have done. Thanks a lot.
Thanks & Regards,
Ben
Re: Inserting Chinese character record to DB
Posted by Francis De Brabandere <fr...@gmail.com>.
I think this still is something we should fix for non-prepared statements
On Mon, Nov 7, 2011 at 9:41 AM, Ben Ng <cn...@gmail.com> wrote:
> Hi Rainer,
>
> It seems that my problem have been solved when I enable prepared statement.
> Thank you for your help.
>
> Regards,
> Ben
>
> On Mon, Nov 7, 2011 at 4:19 PM, Rainer Döbele <do...@esteam.de> wrote:
>>
>> Hi Ben,
>>
>>
>>
>> I don’t know for sure but it may be a good idea to tell Empire-db to use
>> prepared statements.
>>
>> Simply write:
>>
>> db.setPreparedStatementsEnabled(true);
>>
>> in your initialization code.
>>
>>
>>
>> Please let us know whether this works and tell us which DBMS and
>> JDBC-Driver you are using.
>>
>> Regards
>>
>>
>>
>> Rainer
>>
>>
>>
>>
>>
>> from: Ben Ng [mailto:cnj125@gmail.com]
>> to: empire-db-user@incubator.apache.org
>> re: Re: Inserting Chinese character record to DB
>>
>>
>>
>> Hi Empire-DB team,
>>
>> I am trying to insert a record with Chinese character from my JSP page.
>> The encoding is set to UTF-8 already and I am trying to insert the record
>> by the code below where "remarks" is a string contain Chinese characters.
>>
>>
>>
>>
>> DBRecord rec = new DBRecord();
>> rec.create(db.REQUESTS);
>> rec.setValue(db.REQUESTS.REMARKS, remarks);
>> rec.update(conn);
>>
>> After inserting the record, the data of the field REMARKS become "???".
>>
>>
>>
>>
>> I tried to use traditional method(PreparedStatement) to insert this record
>> by using the same db and connection.
>> The data can be inserted correctly.
>> Is there any step I have missed in my code so it can support UTF-8?
>>
>>
>>
>>
>> I really appreciate for what your team have done. Thanks a lot.
>>
>> Thanks & Regards,
>> Ben
>
--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.
Re: Inserting Chinese character record to DB
Posted by Ben Ng <cn...@gmail.com>.
Hi Rainer,
It seems that my problem have been solved when I enable prepared statement.
Thank you for your help.
Regards,
Ben
On Mon, Nov 7, 2011 at 4:19 PM, Rainer Döbele <do...@esteam.de> wrote:
> Hi Ben,****
>
> ** **
>
> I don’t know for sure but it may be a good idea to tell Empire-db to use
> prepared statements.****
>
> Simply write:****
>
> db.setPreparedStatementsEnabled(true);****
>
> in your initialization code.****
>
> ** **
>
> Please let us know whether this works and tell us which DBMS and
> JDBC-Driver you are using.****
>
> Regards****
>
> ** **
>
> Rainer****
>
> ** **
>
> ** **
>
> *from:* Ben Ng [mailto:cnj125@gmail.com]
> *to:* empire-db-user@incubator.apache.org
> *re:* Re: Inserting Chinese character record to DB****
>
> ** **
>
> Hi Empire-DB team,
>
> I am trying to insert a record with Chinese character from my JSP page.
> The encoding is set to UTF-8 already and I am trying to insert the record by the code below where "remarks" is a string contain Chinese characters.
>
> ****
>
> ** **
>
>
> DBRecord rec = new DBRecord();
> rec.create(db.REQUESTS);
> rec.setValue(db.REQUESTS.REMARKS, remarks);
> rec.update(conn);
>
> After inserting the record, the data of the field REMARKS become "???".
>
> ****
>
> ** **
>
> I tried to use traditional method(PreparedStatement) to insert this record by using the same db and connection.
> The data can be inserted correctly.
> Is there any step I have missed in my code so it can support UTF-8?
>
> ****
>
> ** **
>
>
> I really appreciate for what your team have done. Thanks a lot.
>
> Thanks & Regards,
> Ben****
>
>
re: Inserting Chinese character record to DB
Posted by Rainer Döbele <do...@esteam.de>.
Hi Ben,
I don't know for sure but it may be a good idea to tell Empire-db to use prepared statements.
Simply write:
db.setPreparedStatementsEnabled(true);
in your initialization code.
Please let us know whether this works and tell us which DBMS and JDBC-Driver you are using.
Regards
Rainer
from: Ben Ng [mailto:cnj125@gmail.com]
to: empire-db-user@incubator.apache.org
re: Re: Inserting Chinese character record to DB
Hi Empire-DB team,
I am trying to insert a record with Chinese character from my JSP page.
The encoding is set to UTF-8 already and I am trying to insert the record by the code below where "remarks" is a string contain Chinese characters.
DBRecord rec = new DBRecord();
rec.create(db.REQUESTS);
rec.setValue(db.REQUESTS.REMARKS, remarks);
rec.update(conn);
After inserting the record, the data of the field REMARKS become "???".
I tried to use traditional method(PreparedStatement) to insert this record by using the same db and connection.
The data can be inserted correctly.
Is there any step I have missed in my code so it can support UTF-8?
I really appreciate for what your team have done. Thanks a lot.
Thanks & Regards,
Ben