关于tomcat5+mysql3.23.39-nt连接池的字符编码设置问

04-07-22 wubai
关于tomcat5+mysql3.23.39-nt连接池的字符编码设置问题

我看MySQL Connector/J Documentation中说的

The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being optional:

jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

也就是说多个参数要用"&"连接

server.xml的部分代码
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/struts?useUnicode=true&characterEncoding=gb2312</value>
</parameter>

然后启动tomcat
有如下部分错误信息
2004-7-18 11:36:37 org.apache.commons.digester.Digester fatalError
服务器: Parse Fatal Error at line 423 column 91: The reference to entity "charac
terEncoding" 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)


所以我将“&”改成了“;”

这到底是为什么啊?怎么会出现这种现象?

banq
2004-07-22 15:47
这很正常

wubai
2004-07-22 15:57
问题出现了,有没有解决的办法


还有一事不明


bang 为什么将我的一个贴子删除
内容大致为:"为什么不能修改自己的密码和Email"

skyleaf24
2004-07-23 09:16
xml里“&”需要用“&”替换。

skyleaf24
2004-07-23 11:58
被过滤掉了,XML里“&” 要用"& a m p ;"替代。(中间本来是没空格的)