如何使用 Postgresql 数据库在 Heroku 上部署?
How to deploy on Heroku with Postgresql Database?
我在 spring 上有一个简单的休息应用程序。对于部署,我已经创建了 2 个配置文件 - dev 和 heroku。使用开发配置文件一切正常。但是我无法部署到 Heroku:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default) on project myProject: Error setting up or running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://aa2-22-222-222-222.aaaaaa-1.amazonaws.com:5432/aaaaaaaaa with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL -> [Help 1]
我认为问题出在我的旧驱动程序上(本地我使用的是 PG 9.4,但在 Heroku 上是 9.6)
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
更新后问题没有解决。
我尝试直接使用连接字符串并从 System.env
使用连接字符串,但结果是一样的。
我该如何解决这个问题?
您的数据库 URL 以 jdbc:postgres://
开头,但应该是 jdbc:postgresql://
.
我建议使用提供的 JDBC_DATABASE_URL
环境变量而不是自己解析 DATABASE_URL
:
我在 spring 上有一个简单的休息应用程序。对于部署,我已经创建了 2 个配置文件 - dev 和 heroku。使用开发配置文件一切正常。但是我无法部署到 Heroku:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default) on project myProject: Error setting up or running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://aa2-22-222-222-222.aaaaaa-1.amazonaws.com:5432/aaaaaaaaa with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL -> [Help 1]
我认为问题出在我的旧驱动程序上(本地我使用的是 PG 9.4,但在 Heroku 上是 9.6)
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
更新后问题没有解决。
我尝试直接使用连接字符串并从 System.env
使用连接字符串,但结果是一样的。
我该如何解决这个问题?
您的数据库 URL 以 jdbc:postgres://
开头,但应该是 jdbc:postgresql://
.
我建议使用提供的 JDBC_DATABASE_URL
环境变量而不是自己解析 DATABASE_URL
: