原因是连接数据库的地址(url)后没有设置字符编码集。

url前缀: jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx

 解决方案:

(mysql驱动5版本)在连接地址后加上 ?useUnicode=true&characterEncoding=UTF-8      

(mysql驱动8版本)在连接地址后加上?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC

java 使用jdbc查询mysql数据库怎么也查不出,但是直接在mysql中能查的到

相关文章:

  • 2021-08-10
  • 2022-12-23
  • 2021-04-18
  • 2022-12-23
  • 2021-09-29
  • 2021-07-02
  • 2021-06-05
  • 2021-11-28
猜你喜欢
  • 2021-12-10
  • 2021-12-20
  • 2022-12-23
  • 2021-04-27
  • 2021-10-21
  • 2021-08-03
相关资源
相似解决方案