【发布时间】:2018-12-12 21:30:32
【问题描述】:
我正在使用PostgreSQL 和spring-boot-2.0.1 并希望我的应用程序在数据库不存在时创建它。
我的application.properties中有以下选项
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=postgres
spring.datasource.password=123
上面我得到了错误:
Caused by: org.postgresql.util.PSQLException: FATAL: database "mydb" does not exist
知道我错过了什么吗?
【问题讨论】:
-
generate-ddl 配置只作用于表而不作用于数据库;如果数据库不存在,则不会创建
标签: spring postgresql spring-boot spring-data