2 Replies Latest reply on Dec 17, 2007 1:25 AM by Adam Bońkowski

    JBoss + MySQL + Persistence encoding issues

    Adam Bońkowski Newbie

      I'm using JBoss 4.2.1 with MySQL 5.0.48. The app I develop is an EJB3 with Java Persistence app. I'd like to store text data in UTF-8.
      I added "&useUnicode=true&characterEncoding=UTF" to the connection url in my xa-datasource. I also set

      in persistence.xml
      The default character set of the MySQL database and all its tables is utf8.

      However there are some problems:
      1. When I send some data from a web form with utf8 set in meta everything is stored correctly in the database.
      2. When I hardcode strings in Java and invoke some methods putting data, the text in database is encoded in ISO 8859-2 aka latin2 even though the sources are in utf8 (ISO 8859-2 is the encoding of my system which is CentOS 5).
      3. When I try to transfer from one database (Oracle with ISO 8859-2) to another (mentioned MySQL) the data is also stored in ISO 8859-2.

      Why isn't the conversion done?
      This happens even though i set the env variable $LANG to pl_PL.UTF-8.