@@ -530,8 +530,9 @@ public boolean configureClientCharacterSet(boolean dontCheckServerMatch) {
530530
531531 this .characterEncoding .setValue (realJavaEncoding );
532532 } /* not utf-8 */ else {
533- String mysqlCharsetName = connectionCollationSuffix .length () > 0 ? connectionCollationCharset : CharsetMapping
534- .getMysqlCharsetForJavaEncoding (realJavaEncoding .toUpperCase (Locale .ENGLISH ), getServerSession ().getServerVersion ());
533+ String mysqlCharsetName = connectionCollationSuffix .length () > 0 ? connectionCollationCharset
534+ : CharsetMapping .getMysqlCharsetForJavaEncoding (realJavaEncoding .toUpperCase (Locale .ENGLISH ),
535+ getServerSession ().getServerVersion ());
535536
536537 if (mysqlCharsetName != null ) {
537538
@@ -815,6 +816,7 @@ public void loadServerVariables(Object syncMutex, String version) {
815816 queryBuf .append (", @@lower_case_table_names AS lower_case_table_names" );
816817 queryBuf .append (", @@max_allowed_packet AS max_allowed_packet" );
817818 queryBuf .append (", @@net_write_timeout AS net_write_timeout" );
819+ queryBuf .append (", @@performance_schema AS performance_schema" );
818820 if (!versionMeetsMinimum (8 , 0 , 3 )) {
819821 queryBuf .append (", @@query_cache_size AS query_cache_size" );
820822 queryBuf .append (", @@query_cache_type AS query_cache_type" );
@@ -1045,7 +1047,16 @@ private String findProcessHost(long threadId) {
10451047 try {
10461048 String processHost = null ;
10471049
1048- NativePacketPayload resultPacket = sendCommand (this .commandBuilder .buildComQuery (null , "SHOW PROCESSLIST" ), false , 0 );
1050+ String ps = this .protocol .getServerSession ().getServerVariable ("performance_schema" );
1051+
1052+ NativePacketPayload resultPacket = versionMeetsMinimum (5 , 6 , 0 ) // performance_schema.threads in MySQL 5.5 does not contain PROCESSLIST_HOST column
1053+ && ps != null && ("1" .contentEquals (ps ) || "ON" .contentEquals (ps ))
1054+ ? sendCommand (this .commandBuilder .buildComQuery (null ,
1055+ "select PROCESSLIST_ID, PROCESSLIST_USER, PROCESSLIST_HOST from performance_schema.threads where PROCESSLIST_ID="
1056+ + threadId ),
1057+ false , 0 )
1058+ : sendCommand (this .commandBuilder .buildComQuery (null , "SHOW PROCESSLIST" ), false , 0 );
1059+
10491060 Resultset rs = ((NativeProtocol ) this .protocol ).readAllResults (-1 , false , resultPacket , false , null , new ResultsetFactory (Type .FORWARD_ONLY , null ));
10501061
10511062 ValueFactory <Long > lvf = new LongValueFactory (getPropertySet ());
0 commit comments