简体   繁体   English

与mariadb而不与mysql5.5的IncorrectString

[英]IncorrectString with mariadb and not with mysql5.5

A java application using payara (glassfish) try to save the body of an email into a column into db (with eclipslink) We have the same application onto 2 different server,that differ for dbserver: the first one is with mariadb 10.1.26 (java 1.8.0_131), the second one with mysql 5.5.57 (java 1.8.0_144) The same mail from the first server throws 一个使用payara(glassfish)的Java应用程序尝试将电子邮件的正文保存到db的列中(使用eclipslink)。我们将同一应用程序放置在2个不同的服务器上,这对于dbserver来说是不同的:第一个是使用mariadb 10.1.26( Java 1.8.0_131),第二个与mysql 5.5.57(java 1.8.0_144)来自第一台服务器的相同邮件抛出

Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.qualifier): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect string value: '\xEF\xBF\xBD1 h...' for column 'msg_body' at row 1

What is really strange for me is that with the second server the import goes flowless, no warning, body saved 对我来说真正奇怪的是,使用第二台服务器后,导入变得顺畅,没有任何警告,节省了机体

We have already checked the configuration of the two server, and seems to be both equal The foloowing are exactly the same onto the 2 databases: 我们已经检查了两个服务器的配置,并且看起来都一样。以下两个数据库的完全相同:

-All the table are with character_set_name latin1 -所有表都带有character_set_name latin1

-the variable collation are -变量排序规则是

collation_connection = utf8mb4_unicode_ci collat​​ion_connection = utf8mb4_unicode_ci

collation_database = utf8mb4_general_ci collat​​ion_database = utf8mb4_general_ci

collation_server = utf8mb4_general_ci collat​​ion_server = utf8mb4_general_ci

As said, the two database have exactly the same conf. 如上所述,两个数据库具有完全相同的配置。 Do anybody have idea why one server is working and the other no? 有人知道为什么一台服务器在工作,而另一台不在吗?

我们进行了大量测试,似乎差异在于数据库服务器的全局变量,具有mariadb的计算机具有utf8mb4_general_ci,而mysql具有latin1_swedish_ci更改了mariadb服务器“似乎”的值已解决了问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM