MySQL 配置
#yml
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/my_db(my_db为数据库名称)
username: root
password: root
#properties
spring.datasource.url=jdbc:mysql://域名:端口号/数据库名称?characterEncoding=UTF-8
spring.datasource.username=用户名
spring.datasource.password=密码
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
SqlServer 配置
#yml
spring:
datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=test(test数据库名称)
username: sa
password: root
#properties
spring.datasource.master.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=land_db
spring.datasource.master.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.master.username=sa
spring.datasource.master.password=root
Oracle配置:
#properties
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:data
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5