Reputation: 4521
I want to run a simple PostgreSQL query with Erlang and epgsql similar to Erlang and PostgreSQL. I am getting
** exception error: no match of right hand side value
{error,
{authentication,
[{severity,'Ð\222Ð\220Ð\226Ð\235Ð\236'},
{code,"28000"},
{message,[208,191,208,190,208,187,209,140,208,183,208,190,208,178,208,176,209,130,208,181|...]},
{file,"auth.c"},
{line,302},
{routine,"auth_failed"}]}}
on
{ok, C} = pgsql:connect("localhost",
"postgres",
"password",
[{database, "postgres"}]).
My PostgreSQL instance works fine and I can add a table to my database or run simple queries. But I need to do it with epgsql. And furthermore, I can't read error message, this is what I can see:
[208,191,208,190,208,187,209,140,208,183,208,190,208,178,208,176,209,130,208,181|...]
Upvotes: 0
Views: 2774
Reputation: 137
I have seen similar error 28000 INVALID AUTHORIZATION SPECIFICATION, while using epgsql:connect function.
I have followed the folks suggestion, changing the pg_hba.conf local method type to trust and ident. But no luck!. Tries with, by creating a new user and grant permission on the psql side as well. But no luck.
local all all password #trust
Finally, after the following below update in the pg_hba.conf file(restart of the postgresql service), it is working for me on centos 7.
host all all 127.0.0.1/32 password #ident
Upvotes: 0
Reputation: 196
I installed egpsql, did a direct test, and confirmed that the second parameter for connect
is the username and the third is the password:
{ok, C} = pgsql:connect("localhost", "username", "password", [{database, "db_name"}]).
{ok, Columns, Rows} = pgsql:squery(C, "select * from myschema.mytable").
Upvotes: 1