无法使用“pg” gem 连接到 postgres?

菲利普·柯克布莱德

我有以下代码,我试图在其中测试与 postgres 的连接:

require 'pg'

conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetbdb")
res  = conn.exec('select tablename, tableowner from pg_tables')

我得到错误:

test.rb:3:in initialize': FATAL: password authentication failed for user "puppetdb" (PG::ConnectionBad) from test.rb:3:innew' 来自 test.rb:3:in `'

然而,我有一个具有相同凭据的 python 脚本,它似乎运行良好:

import psycopg2

try:
    conn = psycopg2.connect("dbname='puppetdb' user='puppetdb' host='localhost' port='5432' password='puppetdb'")

鉴于 python 脚本,我想知道我是否输入了错误的凭据?

格里

您的密码输入错误 ( puppetbdb):

conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetdb")

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章