1.修改数据库字符集为utf-8:
ALTER TABLE employee CONVERT TO CHARACTER SET utf8
2.在连接数据库的后面加上:?useUnicode=true&characterEncoding=UTF-8
private static final String URL="jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=UTF-8";
private static final String USERNAME="root";
private static final String PASSWORD="123456";
conn=DriverManager.getConnection(URL,USERNAME,PASSWORD);