This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate + MySQL Encoding

 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Folks,

I'm having trouble with charset encoding in a application that uses Hibernate and MySQL... When I update (through the site) a registry with a local char (like an accent for example) the record in the database gets wrong, with mixed chars...

I've executed manualy the update query in the MySQL Query Browser and the charset looks just great... So, I think the problem is on the Hibernate configuration or in some point of the mysql connection. Can anybody help me?

Thanks in advance.
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to check connection string that you use. For russian char-set I am using

 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried to use this in the hibernate.cfg.xml



Then in the logs I get this:

INFO - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/star
INFO - connection properties: {user=root, password=****, charSet=ISO8859_1}

But the problem remains...

The strange is that when I load the page the data is OK, with the accent (from a manually update), but after doing an update in the page the registry get messed.
 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

after debugging the app I found the error was when getting the values from the JSP page! I solved it just changing the page directive. Refeer to this link for more details:

http://www.coderanch.com/t/52345/Struts/Encoding

Thanks every one!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic