在jdbc连接代码的URL后加后缀 ?useUnicode=true&characterEncoding=utf8
配置如下:
private String Driver=\"com.mysql.jdbc.Driver\";private String url=\"jdbc:mysql://127.0.0.1:3306/sj?useUnicode=true&characterEncoding=utf8\";private String username=\"root\";private String password=\"123456\";