这几天做毕设,从java通过hibernate读写数据库,
出现读mysql中文字符正常,但是写的时候,出现中文变成”?”的问题,很是烦躁。在网上查了一下,主要有以下几个方面需要注意:
1.表的charset都设置成了utf8 ,collation设置成了utf8_general_ci;
2.表中每个column的charset和collation要跟1一致;
3.myeclipse项目的字符集(项目上右键选择属性->Resource->Text file encoding中选择other->UTF-8)
4.hibernate.cfg.xml文件中:<property name="connection.url">jdbc:my