【发布时间】:2019-10-08 17:08:09
【问题描述】:
我在 Java 中创建了一个 Spring Boot 项目,它与我的本地数据库完美配合,但我无法将它连接到我的 GCP postgres 云 SQL 实例。
我已按照以下步骤操作:https://cloud.spring.io/spring-cloud-gcp/multi/multi__spring_jdbc.html 我还在 pom.xml 中做了必要的更改。 我需要在 application.properties 文件中更改什么吗?
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.datasource.initialization-mode=always
spring.datasource.initialize=true
spring.datasource.schema=classpath:/schema.sql
spring.datasource.continue-on-error=true
我希望我的项目能够正常运行,指向云数据库。
【问题讨论】:
-
请提供您现在面临的错误。您可能在日志中有异常,并带有与数据库相关的错误消息。如果我们一开始就有这个错误,那么找出问题所在会更容易。
标签: java postgresql maven spring-cloud-gcp