-->
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: turkish chars
PostPosted: Thu Aug 11, 2005 8:49 am 
Beginner
Beginner

Joined: Wed Aug 10, 2005 4:22 am
Posts: 24
I am using hibernate 3.0 and mysql 4.0.15.

I have some problems with turkish chars(i-with no dot, s-with dot and some others).
hibernate save records that include some of the chars above as '?'. for example when i save 'kamıl' it saves it like 'kam?l'.

Also i have an other question. after enabling show_sql i see the sql queries on the console but i cannot see the values like below.

insert into ...... values(?,?,?)


Top
 Profile  
 
 Post subject: Problem may be based on Mysql JDBC Driver
PostPosted: Thu Aug 11, 2005 9:36 am 
Newbie

Joined: Sat Jan 15, 2005 12:47 pm
Posts: 6
Hi, maybe the problme is absed on your JDBC Driver,
Java handles Strings as UTF (Unicode), so your Turkish characters will be visible without any problems on Java side.
I guess the problem is that the JDBC driver of Mysql does not save it as UTF in your mysql Table and tries to convert them without success.
Ther are 2 Ways to change this.
1. You add the usage of UTF to your JDBC driver
For this use in your hibernate config the following connection string:
jdbc:mysql://localhost/testchar?useUnicode=true&character
Encoding=utf8

or
2. You create your Table or Database per default with UTF encoding.
You may try with:

CREATE TABLE `testchar` (
`testchar` varchar(100) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


This should help you.


Top
 Profile  
 
 Post subject: Re: turkish chars
PostPosted: Thu Aug 11, 2005 3:02 pm 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
e120281 wrote:
I am using hibernate 3.0 and mysql 4.0.15.

I have some problems with turkish chars(i-with no dot, s-with dot and some others).
hibernate save records that include some of the chars above as '?'. for example when i save 'kamıl' it saves it like 'kam?l'.


That could be a problem with your database encoding (see posting above), but you should also use the following query style:

Code:
String value = "turkishCharacters";
Query query = session.createQuery("select ... from ... where c.abc = :value");
query.setString("value", value);



e120281 wrote:
Also i have an other question. after enabling show_sql i see the sql queries on the console but i cannot see the values like below.

insert into ...... values(?,?,?)


Use log4j.logger.org.hibernate.type=DEBUG in your log4j.properties. and the parameters will be logged as well.

Best regards
Sven


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.