解决JDBC连接MySQL数据库出现中文乱码的问题
解决方案:在原有连接MySQL数据库的代码基础上添加:?useUnicode=true&characterEncoding=utf-8
原本:
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test", "root", "123456");
修改之后:
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=utf-8", "root", "123456");