这个异常是java项目往数据库的表里面添加中文时全部显示为????号

问题原因:填入的数据与数据库的指定的字符集不同。

解决方案,建立链接时指定格式gbk

public static final String DBURL="jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=CST&useUnicode=true&characterEncoding=gbk";

  然后把数据库的对应表的字符集换成gbk

Incorrect string value: '\xE5\xBC\xA0\xE4\xB8\x89' for column 'name' at row 1

Incorrect string value: '\xE5\xBC\xA0\xE4\xB8\x89' for column 'name' at row 1

 你直接在数据库哪里选择编码方式是不够的(如下)还是会出错必须指定每一列的字符集

Incorrect string value: '\xE5\xBC\xA0\xE4\xB8\x89' for column 'name' at row 1

 

相关文章:

  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2022-01-11
  • 2021-10-11
  • 2022-01-05
猜你喜欢
  • 2021-11-07
  • 2021-06-04
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案