记一次xml文件中,value值存在&符号引起错误
在这里插入图片描述

连接mysql的配置文件中密码存在特殊字符&,程序为wpf的客户端程序,程序启动没有任何反应,事件查看器中报错:
异常信息: System.Xml.XmlException 在 System.Xml.XmlTextReaderImpl.Throw(System.Exception) 在 System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean, EntityExpandType, Int32 ByRef) 在 System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32, Char, NodeData) 在 System.Xml.XmlTextReaderImpl.ParseAttributes() 在 System.Xml.XmlTextReaderImpl.ParseElement() 在 System.Xml.XmlTextReaderImpl.ParseElementContent() 在 System.Xml.XmlLoader.LoadNode(Boolean) 在 System.Xml.XmlLoader.LoadDocSequence(System.Xml.XmlDocument) 在 System.Xml.XmlDocument.Load(System.Xml.XmlReader) 在 System.Xml.XmlDocument.Load(System.String) 在 IBatisNet.Common.Utilities.Resources.GetResourceAsXmlDocument(System.String) 异常信息: IBatisNet.Common.Exceptions.ConfigurationException 在 IBatisNet.Common.Utilities.Resources.GetResourceAsXmlDocument(System.String) 在 IBatisNet.Common.Utilities.Resources.GetAsXmlDocument(System.Xml.XmlNode, System.Collections.Specialized.NameValueCollection) 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseGlobalProperties() 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize() 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(System.Xml.XmlDocument, IBatisNet.Common.DataSource, Boolean, Boolean) 异常信息: IBatisNet.Common.Exceptions.ConfigurationException 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(System.Xml.XmlDocument, IBatisNet.Common.DataSource, Boolean, Boolean) 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(System.Xml.XmlDocument, Boolean) 在 IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure(System.IO.Stream)

从这报错信息中没有考虑到是密码中特殊字符出现的问题,用Navicat客户端连接数据库是正常的,各种从其他方面找问题,都没有作用,后面重新建一个用户,密码是简单的,程序就能启动了。
解决办法:
在xml文件中 & 要用& 替代 ,value=“123&456”
或修改密码不包含&字符

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐