Mybatis测试链接数据库在主配置文件里面书写url源代码如下:
<property name="url" value="jdbc:mysql://localhost:3306/mybatis01?useUnicode=true&serverTimezone=UTC&useSSL=false"></property>
报错信息
org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException:
Error creating document instance.
Cause: org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 113; 对实体 "serverTimezone" 的引用必须以 ';' 分隔符结尾。
正确书写如下
<property name="url" value="jdbc:mysql://localhost:3306/mybatis01?useUnicode=true&serverTimezone=UTC&useSSL=false"></property>
扩展:在外部(使用数据源)链接数据库时就不用修改“&”这个修饰符
jdbc.url=jdbc:mysql://localhost:3306/sshdemo?useSSL = false&serverTimezone = UTC&