2

Which of this notation is proper in persistence.xml file for web application in TomEE server with OpenJPA module to connect with MySQL database and set UTF-8 encoding?

  1. <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db?useUnicode=yes&amp;characterEncoding=UTF-8"/>
    (yes and UTF-8)

  2. <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db?useUnicode=true&amp;characterEncoding=utf8"/>
    (true and utf8)

  3. <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db?useUnicode=true&connectionCollation=utf8_general_ci/>

For what is property characterSetResults=utf8? Should I use it to change encoding or not?

kuba44
  • 1,838
  • 9
  • 34
  • 62
  • 1
    All the properties are listed and described in the documentation (surprisingly): http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html – JB Nizet Dec 21 '13 at 12:18
  • thanks, but at `characterEncoding` property there isn't information about proper value: `utf8` or `UTF-8` – kuba44 Dec 21 '13 at 12:30
  • 1
    http://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html – JB Nizet Dec 21 '13 at 12:35

0 Answers0