前言
先赞后看,此生必赚!
本文使用Oracle作为数据库,MySQL数据库类似。
解决方案
pom.xml配置:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc8</artifactId> <version>12.2.0.1</version> </dependency> <dependency> <groupId>cn.easyproject</groupId> <artifactId>orai18n</artifactId> <version>12.1.0.2.0</version> </dependency>
application.yml配置:
spring: datasource: url: jdbc:oracle:thin:@192.168.5.5:1521:orcl username: drg password: drg driver-class-name: oracle.jdbc.driver.OracleDriver initialization-mode: always schema: - classpath:schema.sql data: - classpath:data.sql jpa: hibernate: ddl-auto: update
application.properties配置:
spring.datasource.url=jdbc:oracle:thin:@192.168.5.5:1521:orcl spring.datasource.username=drg spring.datasource.password=drg spring.datasource.driver-class-name=oracle.jdbc.OracleDriver spring.datasource.initialization-mode=always spring.datasource.schema=classpath:schema.sql spring.datasource.data=classpath:data.sql spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true