關於tomcat5+mysql3.23.39-nt連線池的字元編碼設定問

wubai發表於2004-07-22
關於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)


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

這到底是為什麼啊?怎麼會出現這種現象?

相關文章