工具使用的navicat,已经设置数据库的默认编码为utf-8,Eclipse编码为utf-8,插入中文仍有乱码,
使用hibernate工程的配置如下,改变
hibernate的配置文件中的属性
<property name="hibernate.connection.url"><![CDATA[
jdbc:mysql://localhost:3306/hibernate_db?useUnicode=true&characterEncoding=utf8
]]>
</property>
同理,使用jdbc方式的时候,也应该做同样的修改,即在路径后面加上?useUnicode=true&characterEncoding=utf8字段