相关疑难解决方法(0)

Heroku数据库连接属性

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

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

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

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?
Run Code Online (Sandbox Code Playgroud)

我的连接设置如下:

连接名称 Heroku开发测试

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

港口 5432

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

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

java.sql.SQLException: FATAL: no pg_hba.conf entry for host "75.168.4.146", user "rphbqggxeokuxl", database "dc008iqk0rq4j5", SSL off
Run Code Online (Sandbox Code Playgroud)

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

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

heroku heroku-postgres

42
推荐指数
6
解决办法
4万
查看次数

TypeError:当使用Heroku node.js调用pg.connect时,无法调用null的方法'query'

我遇到一个问题,通过Node.js连接到Heroku postgres数据库.我找到了另一个遇到此问题的人的例子,但他们的建议在我的案例中不起作用.

我将var DB_URL定义为Heroku存储的完整Postgres数据库URL.我这样做是因为没有定义process.env.DATABASE_URL.(这是其他堆栈溢出帖子的建议).

尝试连接的代码是:

pg.connect(DB_URL, function(err, client) {
    client.query( ... )
Run Code Online (Sandbox Code Playgroud)

当领班工作时:

client.query('INSERT INTO bookmarks (username, title, image, url) VALUES (       
^
TypeError: Cannot call method 'query' of null
Run Code Online (Sandbox Code Playgroud)

where by null指的是要传递给pg.connect匿名函数的客户端对象.

建议赞赏,我在Heroku文档和Googled-a-lots周围看起来高低无济于事.

postgresql heroku node.js

10
推荐指数
2
解决办法
3052
查看次数

标签 统计

heroku ×2

heroku-postgres ×1

node.js ×1

postgresql ×1