Bug #22456 utf8_unicode_ci not working in c/j
Submitted: 18 Sep 2006 21:23 Modified: 19 Sep 2006 1:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S4 (Feature request)
Version:5.0.3 OS:Any (*)
Assigned to: CPU Architecture:Any
Triage: D5 (Feature request)

[18 Sep 2006 21:23] Shane Bester
Description:
java.sql.SQLException: Unknown initial character set index '192' received from server. Initial client character set can be forced via the 'characterEncoding' property.
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2342)
    at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3861)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2657)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

How to repeat:
start mysqld server with these parameters:

[mysqld]
character_set_server=utf8
collation_server=utf8_unicode_ci

and try connect to the server with connector/j.

Suggested fix:
.
[19 Sep 2006 1:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/12177
[19 Sep 2006 1:51] Mark Matthews
Fixed in the source repository, will be available in nightly builds after 00:00 GMT, 19-Sept-06.
[15 Oct 2007 13:07] Deepak Kenchamba
In case you are connecting to MySQL the connect database URL should be set as following

jdbc:mysql://10.10.4.110:3306/wops_album?useUnicode=true&characterEncoding=UTF8
or
jdbc:mysql://10.10.4.110:3306/wops_album?characterEncoding=UTF8

instead of just

jdbc:mysql://10.10.4.110:3306/wops_album

Please notice that "Initial client character is being forced via the 'characterEncoding' property to 'UTF-8'.