`
winnerlxh
  • 浏览: 89735 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

SSH tomcat5 Mysql5 中文乱码

    博客分类:
  • SSH
阅读更多
在applicationContext-*.xml中
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property name="jdbcUrl" value="jdbc:mysql://localhost/xsdData?useUnicode=true&amp;characterEncoding=utf-8">
</property>
<property name="user" value="root"></property>
<property name="password" value="root"></property>
注意:value="jdbc:mysql://localhost/xsdData?useUnicode=true&amp;characterEncoding=utf-8"
不要写成:value="jdbc:mysql://localhost/xsdData?useUnicode=true&characterEncoding=utf-8"
注意:&amp; 是& 的转义字符;在xml中写成上面那个,在java代码中写成下面的写法;
否则报:
Parse Fatal Error at line 213 column 91: The reference to entity "characterEncoding" must end with the ';' delimiter.
org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must
end with the ';' delimiter.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics