现象:
1. 数据库中文乱码
控制台显示中文乱码
加载的日志
2016-08-28 16:00:42,894 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:174) DEBUG - JDBC URL --> jdbc:mysql://139.129.118.219:13306/CloudServer
2016-08-28 16:00:42,989 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_client=latin1
2016-08-28 16:00:42,989 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_connection=latin1
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_database=utf8
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_filesystem=binary
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_results=
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_server=latin1
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_set_system=utf8
2016-08-28 16:00:42,990 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:183) DEBUG - Mysql : character_sets_dir=/usr/share/mysql/charsets/
怀疑问题出在上面的连接,如何更改
2016-08-28 16:00:41,695 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:60) DEBUG - Web Container Information:
2016-08-28 16:00:41,704 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:61) DEBUG - - Default Charset : UTF-8
2016-08-28 16:00:41,704 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:62) DEBUG - - Current . path : E:\apache-tomcat-8.0.32\bin\.
2016-08-28 16:00:41,705 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:63) DEBUG - - Java Version : 1.8.0_73
2016-08-28 16:00:41,705 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:64) DEBUG - - File separator : \
2016-08-28 16:00:41,705 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:65) DEBUG - - Timezone : Asia/Shanghai
2016-08-28 16:00:41,705 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:66) DEBUG - - OS : Windows 10 amd64
2016-08-28 16:00:41,705 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:67) DEBUG - - ServerInfo : Apache Tomcat/8.0.32
2016-08-28 16:00:41,707 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:68) DEBUG - - Servlet API : 3.1
2016-08-28 16:00:41,707 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:73) DEBUG - - ContextPath : /bms
2016-08-28 16:05:16,530 org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:255) DEBUG - INSERT INTO st_relate_user_deviceunitname(deviceId,userid,deviceunitid,deviceunitname,projectname,projectid) VALUES(?,?,?,?,?,?)
| 1 | 2 | 3 | 4 | 5 | 6 |
|-----|-----|-----|-----|--------|---|
| 180 | 180 | xxx | ooo | 鏈楄瘲鍗楅棬缁块儭 | 2 |
For example:> "INSERT INTO st_relate_user_deviceunitname(deviceId,userid,deviceunitid,deviceunitname,projectname,projectid) VALUES('180','180','xxx','ooo','鏈楄瘲鍗楅棬缁块儭',2) "