Character encoding issue about Mysql5 and JBoss integration
Posted by:
alex ma
Date: June 19, 2007 02:23AM
hi, I got a very strange problem in my env. I am using mysql 5.0.41 for win32 and JBoss 4.0.5.GA. The default charaset of Mysql is utf8 too.
I create a datasource in JBoss via coping mysql-ds.xml to /server/default/delopy and add these configuration below.
<local-tx-datasource>
<jndi-name>supervisionDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<connection-property name="useUnicode">true</connection-property>
<connection-property name="characterEncoding">utf8</connection-property>
<connection-property name="useLocalSessionState">true</connection-property>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>name</user-name>
<password>pass</password>
</local-tx-datasource>
Now I did a test. In a servlet, I got the datasource through JNDI and try to insert and query some data from it. I can insert Chinese chars into mysql correctly(I can query them in Mysql Query Browser) but I can not read them in our servlet correctly.
On the other hand, if I use jdbc to connect mysql directly, I can read and write Chinese characters from Mysql.
I am not sure whether JBoss will do something to the jdbc driver of Mysql.
Can anyone give me some suggestions? Many thanks.
Subject
Views
Written By
Posted
Character encoding issue about Mysql5 and JBoss integration
5845
June 19, 2007 02:23AM
2626
June 20, 2007 03:08AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.