1. 查看jdbc配置是否指定编码

    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testjdbc","root","123456");

在原先的配置上指定编码即可?characterEncoding=utf8

    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testjdbc?characterEncoding=utf8","root","123456");

2. 查看mysql数据库及表编码格式是否正常

JDBC插入中文数据出现?号地解决问题

上面的即是正确配置,防止中文字符乱码

如果不是的话,需要到my.ini文件中添加或修改

    [mysqld]
    default_authentication_plugin=mysql_native_password
    port = 3306
    character_set_server = utf8

重启mysql

相关文章:

  • 2022-12-23
  • 2021-09-03
  • 2021-10-18
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2021-12-19
  • 2021-12-01
  • 2022-12-23
  • 2021-09-23
  • 2021-12-02
  • 2021-04-14
相关资源
相似解决方案