tags:

views:

66

answers:

2

when i insert persian information with use JEE6(JSF and JPA) my information save question mark for example "علی" ===> "???" my database is Mysql and my table is UTF-8 . when insert persian data directly in database is correct and save correct. i know that with change one property in JEE my problem go to solved but i don`t know where is it ?

A: 

I think that you need to set the following parameters in your connection URL:

jdbc:mysql://host:port/db?useUnicode=true&characterEncoding=UTF-8
Pascal Thivent
Jeus
Jesper
I change sun-resources.xml but not solvedhttp://paste.ideaslabs.com/show/XWBCp5zl0Y
Jeus
@Jeus I suggest trying to isolate the problem. So write a simple class using JDBC to validate the connection URL. Once you'll get it working, work on the app server configuration.
Pascal Thivent
i use JPA and i dont have problem in insert data correctly in database with query browser mysql but then insert with use my app insert ? in database
Jeus
@Jeus I understood that so the MySQL setup seems ok. But is it working from Java? No? Is it a problem with the driver? You don't know. Is it a problem with the app server setup? You don't know. So try to isolate the problem, start with a simple Java class using JDBC to validate the behavior of the JDBC driver. Then work on the app server config.
Pascal Thivent
i understand u and test all say u this is first app with jEE6 and already write other JSE app and this dosnt its problem with encoding . im run a already program for test again.and this work correct .
Jeus
A: 

with change in my.cnf (mysql configure file)in \etc\mysql (linux) and add this 2 tag solved my problem default-character-set=utf8 default-collation=utf8_persian_ci

Jeus
I suspect a bug in the MySQL JDBC driver.
BalusC