java - mysql utf-8 returns gibberish from one machine -


i have mysql db utf-8 , application written in java hibernate. when run application in eclipse fine. in production on different machine values returned db corrupted. print values log (immediately after getting them) , see values db corrupted in production.

the db same db both environments. values stored fine.

any ideas can reason this?

update:

i forgot happens sometimes. think in 50% of times works fine.

update 2:

here hibernate.cfg.xml:

<!doctype hibernate-configuration public     "-//hibernate/hibernate configuration dtd 3.0//en"     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration>   <session-factory>     <property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property>     <property name="hibernate.connection.url">jdbc:mysql://mydb:3306/myapp?autoreconnect=true&amp;useunicode=true&amp;createdatabaseifnotexist=true&amp;characterencoding=utf-8</property>     <property name="hibernate.connection.username">username</property>     <property name="hibernate.connection.password">password</property>     <!-- <property name="hibernate.connection.pool_size">10</property> -->     <property name="hibernate.connection.isolation">2</property>     <property name="show_sql">true</property>     <property name="dialect">org.hibernate.dialect.mysqldialect</property>     <property name="hibernate.hbm2ddl.auto">update</property>        <property name="hibernate.connection.provider_class">com.zaxxer.hikari.hibernate.hikariconnectionprovider</property>      <property name="hibernate.hikari.minimumidle">5</property>      <property name="hibernate.hikari.maximumpoolsize">10</property>      <property name="hibernate.hikari.idletimeout">30000</property>       <mapping class="someclass1"/>                <mapping class="someclass2"/>                <mapping class="someclass3"/>                <mapping class="someclass4"/>                   </session-factory>  </hibernate-configuration>  

reference url: https://docs.jboss.org/exojcr/1.12.13-ga/developer/en-us/html/ch-db-configuration-hibernate.html

please verify datasource configuration in production environment whether attributes - useunicode , characterencoding set properly.
example:

<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/exodb?relaxautocommit=true&amp;amp;autoreconnect=true&amp;amp;useunicode=true&amp;amp;characterencoding=utf8"/> 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -