SSH tomcat5 Mysql5 中文乱码

在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)

你可能感兴趣的:(apache,mysql,xml,jdbc,ssh)