postgresql - Heroku Postgres 数据库计划更改导致应用程序崩溃

标签 postgresql ssl heroku

我刚刚将 heroku 应用程序的数据移动到更新版本的更大数据库中。重新启动应用程序时,出现错误,在连接到 heroku 之外的数据库时已被广泛讨论。

app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "XX.XX.XX.XX", user "12345678901234", database "12345678901234", SSL off

heroku FAQ 声明:

You are attempting to establish a database connection without SSL. SSL is required for connections [...] for all connections on some newer databases on -0 and -2 plans. Please see the documentation for your postgres driver on how to establish encrypted connections.

我无法访问我的 heroku 实例的 postgres 选项,是吗? 我是否遗漏了任何简单的信息?

其他信息:我正在使用 Play Framework 2.3.7 和 Java。连接由 Heroku 在环境变量中使用不可变值处理。基础架构使用 Heroku Toolbelt 进行管理。

最佳答案

你的 build.sbt 中可能有这样的东西:

"postgresql" % "postgresql" % "9.1-901-1.jdbc4"

改成这样:

"org.postgresql" % "postgresql" % "9.4.1208"

这将默认使用 SSL,如 Heroku Postgresql documentation 中所述.

如果无法升级库,则必须手动将这些参数添加到 DATABASE_URL

ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

关于postgresql - Heroku Postgres 数据库计划更改导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36941475/

相关文章:

java - 如何使用 Fiddler 避免 JAVA 证书警告

android - Android 2.3 中的 SSL 损坏的 PIPE 通过代理调用 HTTPS

python - 如何在不保存的情况下在django中操作用户上传的文件?

sql - 按周过滤查询

sql - 查询 GRANTS 授予 postgres 中的序列

mysql - 在 Heroku 上部署 Rails 应用程序 : ERROR

ruby-on-rails - rails : local server handling SSL

ruby - Heroku 上的 OpenSSL 1.0.1

node.js - 在 Heroku 中完全禁用 HTTP

SQL按查询排序