0
我有以下的代碼,我正在努力考到Postgres的連接:無法使用'pg'寶石連接到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:in
new' from test.rb:3:in `'
但我有相同的憑據一個python腳本似乎工作完美:
import psycopg2
try:
conn = psycopg2.connect("dbname='puppetdb' user='puppetdb' host='localhost' port='5432' password='puppetdb'")
鑑於python腳本我想知道如果我已經輸入憑據錯誤?
'localhost'和'172.17.0.1'是不一樣的 –
是@ C-奧托我更新的python腳本爲localhost閱讀。我只是在本地進行測試,並且python腳本適用於這兩個URL。因爲Docker網絡正在共享到我的本地主機。 –