JDBC 连接数据库的 url
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/smbms?uesSSL=true&useUnicode=true&characterEncoding=UTF-8
username=root
password=123456
Mybatis 配置文件
Mybatis 官网: https://mybatis.org/mybatis-3/zh/getting-started.html
核心配置文件
mybatis-config.xml
注意在 xml 中 &
符合要转义成 &
符号
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--核心配置文件-->
<configuration>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=tru&useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</dataSource>
</environment>
</environments>
</configuration>