Heroku 数据库连接属性 [英] Heroku Database Connection Properties

查看:42
本文介绍了Heroku 数据库连接属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行一项相对微不足道的任务:我想连接到 Heroku 数据库.我已经创建了数据库并从 Heroku 站点获得了凭据.但是,当我尝试使用终端heroku"命令行客户端之外的任何东西连接到该数据库时,我会收到致命错误或无法连接错误.

I'm trying to perform a relatively trivial task: I want to connect to a Heroku database. I have created the database and have been issued credentials from the Heroku site. However, when I try to connect to this database using anything besides the terminal 'heroku' command line client, I get fatal errors or cannot connect errors.

我尝试在 Heroku 终端应用程序之外连接的两个工具是:Navicat 和 IntelliJ.

The two tools that I tried to connect with outside of the Heroku terminal application are: Navicat and IntelliJ.

我在尝试连接数据库时在 Navicat 中收到的错误是:

The error that I receive in Navicat when trying to connect to the database is:

could not connect to server: Host is down
    Is the server running on host "ec2-107-21-112-215.compute-1.amazonaws.com" and accepting
    TCP/IP connections on port 5432?

我的连接设置如下:

连接名称 Heroku 开发测试

Connection Name Heroku Dev Test

主机名/IP 地址 ec2-107-21-112-215.compute-1.amazonaws.com

Host Name/IP Address ec2-107-21-112-215.compute-1.amazonaws.com

端口 5432

Navicat 似乎甚至没有尝试连接到该主机名.

Navicat doesn't even seem to be making an attempt to connect to that hostname.

当我尝试使用完整凭据连接 IntelliJ 时,出现以下错误:

When I try to connect with IntelliJ, using the full credentials, I get the following error:

java.sql.SQLException: FATAL: no pg_hba.conf entry for host "75.168.4.146", user "rphbqggxeokuxl", database "dc008iqk0rq4j5", SSL off

同样,我使用 Heroku 应用程序在访问我的网站上的数据库时提供给我的凭据.

Again, I'm using the credentials that the Heroku application provides me with when accessing my database on their website.

有没有人遇到过这个 Heroku 连接问题?

Has anyone ran into this Heroku connection issue before?

推荐答案

Heroku 提供以下信息用于从外部资源进行连接:

Heroku provides this information for connecting from external sources:

https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-入口

第二条错误消息表明 PostgreSQL 未配置为接受您尝试建立的连接.鉴于 Heroku 提供的信息,一个很好的猜测是您没有使用 SSL 进行连接.尝试在您的连接上启用该功能.

The second error message indicates PostgreSQL is not configured to accept the connection you're trying to make. Given the information Heroku provides, a good guess is that you're not connecting with SSL. Try to enable that on your connection.

以下是在 Navicat 中使用 SSL 的说明:http://mirror.navicat.com/manual/online_manual/en/navicat/rv_manual/ClientCert.html.

Here are instructions for using SSL with Navicat: http://mirror.navicat.com/manual/online_manual/en/navicat/rv_manual/ClientCert.html.

这可能有助于配置 Intellij 以使用 SSL:https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java#connecting-to-a-database-remotely.

This may be helpful in configuring Intellij to use SSL: https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java#connecting-to-a-database-remotely.

这篇关于Heroku 数据库连接属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆