MySQL
pom.xml
代码语言:html复制<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
application.yml
代码语言:javascript复制server:
port: 程序运行在那个端口(一般:8080)
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:// IP : 端口(一般:3306) /person?&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: 123 (填写自己的账号)
password: 123 (填写自己的密码)
SQL Server
pom.xml
代码语言:html复制<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
application.yml
代码语言:yaml复制server:
port: 程序运行在那个端口(一般:8080)
spring:
datasource:
url: jdbc:jtds:sqlserver:// IP : 端口 ;DatabaseName= 某个库名 ;trustServerCertificate=true
driver-class-name: net.sourceforge.jtds.jdbc.Driver
username: 123 (填写自己的账号)
password: 123 (填写自己的密码)
hikari:
connection-test-query: SELECT 1
Oracle
pom.xml
代码语言:html复制<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
application.yml
代码语言:javascript复制server:
port: 程序运行在那个端口(一般:8080)
spring:
datasource:
url: jdbc:oracle:thin:@ IP : 端口 :ORCL
username: 123 (填写自己的账号)
password: 123 (填写自己的密码)
driver-class-name: oracle.jdbc.driver.OracleDriver
这样就配置完了!