日期:2014-05-18  浏览次数:20792 次

hibernate中配置mysql url(使用中文)的问题
配置如下:
<property name="connection.url">
jdbc:mysql://localhost/sc?useUnicode=true&characterEncoding=UTF-8
</property>
这个url在jdbc中使用是没有问题的,但在hibernate中却不能通过,eclipse报出"The reference to entity "characterEncoding" must end with the ';' delimiter"的错误,为什么?我在characterEncoding后加上';'也不起作用。

------解决方案--------------------
jdbc:mysql://localhost:3306/sc?useUnicode=true&amp;characterEncoding=UTF-8

这样写试试
------解决方案--------------------
ls说的没错,&在html或者xml里使用&amp;表示的,否则xml文件本身都会出错。
------解决方案--------------------
你也可以这样写,设置为不可以解析
<![CDATA[jdbc:mysql://localhost/sc?useUnicode=true&characterEncoding=UTF-8]]>
------解决方案--------------------
jdbc:mysql://localhost:3306/sc?useUnicode=true&amp;characterEncoding=UTF-8