These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problem with UTF-8
PostPosted: Sun Feb 11, 2007 7:46 pm 
Newbie

Joined: Tue Jun 08, 2004 9:50 am
Posts: 4
Location: Greece
I try to configure hibernate to use utf-8 encoding.

My setup is Hibernate3.2.2ga and MySQL 5.0.

To tried to set the useUnicode=true and characterEncoding=UTF-8 in the database connection string (hibernate.connection.url).

I also tried to set the hibernate.connection.useUnicode=true and hibernate.connection.characterEncoding=UTF-8. After some search in forums and mailing lists I also tried to set the hiberanate.connection.charSet=UTF-8.

I tried some combinations of utf-8, UTF-8, utf8 etc. Nothing seems to work. (What's the right one?)

While the hibernate initializes itself all the time without any error, when I set the parameter hibernate.hbm2ddl.auto=create-drop, the database tables are automatic to use latin, instead of utf8.

The result is that I get an error saying "SEVERE: Data truncation: Data too long for column 'a_column_name' at row 1"

I tried to remove the hibernate.hbm2ddl.auto=create-drop and set the tables to utf8 manualy in my database. But the problem persists.

Thanks in advance.

_________________
Homo bandwidthous


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 10:22 am 
Beginner
Beginner

Joined: Tue Jul 04, 2006 11:29 am
Posts: 20
Location: Cambs, UK
JPG, I've got exactly the same problem. If you fixed it, could you let me know what you did to solve the problem. If not I'll keep looking for a solution and post back here if I find one.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 5:12 pm 
Newbie

Joined: Tue Jun 08, 2004 9:50 am
Posts: 4
Location: Greece
You are very lucky. I fixed it yesterday.

This problem was related to MySQL. There was a bug in MySQL server. It is fixed in version 5.0.32 and 5.1.14 of the respective branch of MySQL. (look here for more details http://bugs.mysql.com/bug.php?id=18908)

Upgrade your server to solve this issue.


BTW, after I upgraded my server, I had another problem with an error "Incorrect string value...". Hibernate created the tables with latin1 encoding specified explicitly for each varchar column. So despite that my tables were UTF-8, the columns had latin1 encoding. Check with a "show create" if you have the same problem too, after upgrading your database server.

I hope this helps you too.

(sorry for my English)

_________________
Homo bandwidthous


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.