Bug #81188 select json type get garbled reason
Submitted: 24 Apr 2016 11:16 Modified: 25 Apr 2016 7:38
Reporter: xiao zhou Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.37 OS:Any
Assigned to: CPU Architecture:Any
Tags: json type

[24 Apr 2016 11:16] xiao zhou
Description:
MySQL

  Search
Logout / Profile

Developer Zone
Bugs Home
View your bugs
View your subscriptions
Report a bug
Statistics
Advanced search
Saved searches
Tags

Bug #80631	ResultSet.getString return garbled result with json type data
Submitted:	7 Mar 8:01	Modified:	28 Mar 13:14
Reporter:	Tianming Yi	Email Updates:	
Unsubscribe
Status:	Need Feedback	Impact on me:	
None Affects Me
Category:	Connector / J	Severity:	S2 (Serious)
Version:	5.1.38	OS:	Any
Assigned to:		Target Version:	
Tags:	Connector/J, garbled, json, utf8
ViewAdd CommentFilesContributions
The reCAPTCHA wasn't entered correctly. Try it again.
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!

we also confronted this bug. Our environment is that mysql server is 5.7.12 and connector is 5.1.37 or 5.1.38 (the result is the same). we found that if select extract json field and group by any field,we will get garbled character.
For example, when we execute sql like 'select json_extract(xx) from xx group by xx',we will get garbled result.
And we find in this case, server returns field charsetnum is binary(63),without group by is 33. we find that there is json type defined in both connector version 37 and 38 ,so we patched  37 in class Feild‘s constructor by changing collationIndex to 45 ,if mysqltype is json type and collationIndex is 63.now we are looking forward connector / j team fixing this bug 
 

How to repeat:
For example, when we execute sql like 'select json_extract(xx) from xx group by xx',we will get garbled result.

Suggested fix:
And we find in this case, server returns field charsetnum is binary(63),without group by is 33. we find that there is json type defined in both connector version 37 and 38 ,so we patched  37 in class Feild‘s constructor by changing collationIndex to 45 ,if mysqltype is json type and collationIndex is 63
[25 Apr 2016 7:38] Chiranjeevi Battula
Hello xiao zhou,

Thank you for the bug report.
This is duplicate of Bug #80631, please see Bug #80631.
Thank you for your interest in MySQL.

Thanks,
Chiranjeevi.