application.ymlまたはアプリケーションproperties接続データベース構成
MySQL構成
SqlServer構成
Oracle構成:
#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