Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » EclipseLink / MySQL / Connector/J / UTF-8 Issue
EclipseLink / MySQL / Connector/J / UTF-8 Issue [message #1741621] Fri, 26 August 2016 07:04 Go to next message
Eclipse UserFriend
I've set up a small project using Struts 2, Tomcat, Eclipselink and MySQL, which needs to store some special characters in the database using UTF-8. I set up the database tables as "utf8_unicode_ci". The persistance.xml file looks like this:

<properties>
	<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
	<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/xxxxxx?useUnicode=true&amp;characterEncod‌​ing=UTF-8" />
	<property name="javax.persistence.jdbc.user" value="yyyyyyyy" />
	<property name="eclipselink.logging.level" value="FINE"/>
	<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
	<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
	<property name="eclipselink.create-ddl-jdbc-file-name" value="datastore-create.sql"/>
	<property name="eclipselink.drop-ddl-jdbc-file-name" value="datastore-drop.sql"/>
	<property name="eclipselink.application-location" value="/home/richardh/dddd/"/>
	<property name="eclipselink.deploy-on-startup" value="false"/>
	<property name="javax.persistence.jdbc.password" value="zzzzzzz"/>
</properties>


When special characters are entered through the app, the EclipseLink logs show the special characters in the INSERT / UPDATE statements in the log file. However, they aren't in the database correctly. (They show up as "?".) When I take the same statements and manually run them against the database, everything works fine. I'm not sure where to go from here.

Thanks in advance for any ideas anyone can provide.

[Updated on: Fri, 26 August 2016 07:08] by Moderator

Re: EclipseLink / MySQL / Connector/J / UTF-8 Issue [message #1742234 is a reply to message #1741621] Wed, 31 August 2016 23:33 Go to previous message
Eclipse UserFriend
See if all things on java side are configured to use UTF-8, like sources, IDE, tomcat, maven, JVM, Operating System, etc..., you just checked JDBC connection.
Previous Topic:EclipseLink + Stream + Java 8
Next Topic:Eclipse link 2.5 + weblogic 12.1.3 memory issue with DMS
Goto Forum:
  


Current Time: Fri Jul 25 01:06:06 EDT 2025

Powered by FUDForum. Page generated in 0.06563 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top