I faced a problem in one application using Unicode deployed in Glassfish and using Glassfish MySQL JDBC connection pool. The problem was that the queries with Unicode characters were not getting executed properly (e.g. select * from table where field ='नाही' ) from the the application.
Checked in the MySQL server and found that Unicode settings for that database was ok. Db charset was utf8 and collation was utf8_unicode_ci. But the database server’s collation was latin1_swedish_ci and character set was latin1.
Also in our Glassfish MySQL JDBC connection pool the property UseUnicode was true.
So to fix this issue I used another JDBC property and it did the trick.
The property is characterEncoding, and I set it to UTF-8 in the MySQL JDBC connection pool. This property override the automatically detected encoding on the client side and use the character encoding specified by it’s value.