0

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

Pradyut Bhattacharya
  • 5,440
  • 13
  • 53
  • 83
  • 1
    Try: `...&characterSetResults=utf8mb4` – wchiquito Jun 24 '14 at 15:28
  • `(...&characterSetResults=utf8)` solved the problem and it is now showing the character_set_results as utf8mb4. `(...&characterSetResults=utf8mb4)` is not supported and throws a error while connecting. – Pradyut Bhattacharya Jun 25 '14 at 08:20
  • Check: [JDBC url for MySQL configuration to use utf8 character encoding](http://stackoverflow.com/questions/18058297/jdbc-url-for-mysql-configuration-to-use-utf8-character-encoding) – wchiquito Jun 25 '14 at 19:59

1 Answers1

3

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

aven
  • 21
  • 5
  • 1
    Please don't post answers in both English and Chinese - StackOverflow is English only. Thanks! – Rob Apr 13 '17 at 06:40