• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How I can use useUnicode=true&characterEncoding=UTF-8 parameters with JPA connection?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post
I want to use a connection url like jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=UTF-8 for JPA and in the persistece unit I tried to use them like:


when I try to run the application it return an error like:



Please let me know how I can include the parameters without getting an error like that.

Thanks.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to just set a property, as opposed to encoding this in the URL?

-Cameron McKenzie
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Cameron, I tried by adding these two property and there is no effect.



Any other suggestion?
 
Francois Nadeau
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raminaa,

I can't remember all of the details, but we stopped setting the encoding setting on the connection url from MySQL version 4 (MySQL changed the connection mechanism form that version). Instead we set the database encoding to UTF-8 (there's a wizard from windows, Unix flavors will have to change the /etc/my.cnf file and restart the deamon), then create the tables (after changing the encoding), and then use jdbc:mysql://localhost:3306/test as a connection url.

Hope this helps.
 
Olaf Kummer
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that you are inserting an ampersand (&) directly into XML text, where it indicates an entity escape. Use & to get an ampersand character into your text property.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic