mysql connectorJ character set results does not support utf8mb4

*爱你&永不变心* 提交于 2019-12-25 18:11:33

问题


I m having a tomcat server having a connection pool to mysql.

In the connection settings i can see all the character set encodings set to utf8mb4 in *this page except for character_set_results.

My connection string being -

 jdbc:mysql://:3306/abc?character_set_server=utf8mb4&useOldAliasMetadataBehavior=true&character_set_connection=utf8mb4&characterEncoding=utf-8&character_set_results=utf8mb4

In the mysql server i can see character_set_results showing utf8mb4.

But in the jsp page it is not shown anyway.

The mysql version is 5.6.16 and connector version is 5.1.22

Regards


回答1:


connection settings need not characterEncoding and character_set_server, mysql connectorJ will auto check.

make sure character_set_database=utf8mb4,character_set_server=utf8mb4, Table character set=utf8mb4, some columns use varchar character set=utf8mb4;

tip: character_set_server=utf8mb4 need config my.ini Exemple:

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'

loose-default-character-set = utf8mb4
[client]
default-character-set = utf8mb4
loose-default-character-set = utf8mb4

https://dev.mysql.com/doc/refman/5.6/en/charset-unicode-utf8mb4.html?spm=5176.2020520165.110.53.AlPmXp



来源:https://stackoverflow.com/questions/24389862/mysql-connectorj-character-set-results-does-not-support-utf8mb4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!