• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Cameron, I tried by adding these two property and there is no effect.



Any other suggestion?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic