3 Replies Latest reply on Jan 22, 2019 11:53 PM by Narasimha Prasad

    Wildfly 10.1.0 with mysql on centos 6+ problem with connection encoding

    George tsobis Newbie

      Hello to all,

      I have an application that uses most of the java ee 7 (jsf, ejb, cdi, jms, jpa etc).


      The application is hosted on a wildfly 10.1.0 Final and connects to a mysql database through the following datasource.


      <datasource jta="true" jndi-name="java:/commerceDS" pool-name="commerceDS" enabled="true" use-ccm="true">
                          <connection-property name="databaseName">
                              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>


      On a windows 10 machine it works ok, however, when tried to use a linux machine with centos 6+, although the data are persisted to the database, the encoding is wrong. For example I cannot persist or merge greek characters. On the other hand if I input data to the table from an sql editor like workbench, I can retrieve data within the application with the correct encoding.


      I tried using useUnicode=true&amp;characterEncoding=utf-8 on the datasource connection url but it does not work.





      Afterwards I saw in some examples the following useUnicode=true&amp;amp;characterEncoding=utf-8 and I had the same result.


      After testing every configuration I could think of, I tried to create a vm with centos and setup the same environment and had the same problem.

      To solve my problem I had to force mysql to use the utf8 in the my.cnf






      Am I doing something wrong or is this a bug?


      Finally, to point out the obvious I am sure that the data from the jsf form are received from the server with the correct encoding. I have tested writing the received data to the log as well as the faces message of the jsf and they are displayed correctly.



      Tsobis George