Problem scenario
You are trying to connect to a PostgreSQL database. Your database username and password are not working, but you think they should. You get the message: "postgresql.Driver Connection error: org.postgresql.util.PSQLException Fatal: Ident authentication failed for user"
What should you do?
Possible solution #1
Make sure the pg_hba.conf file is configured correctly.
Here is an example if you are trying to connect from your local machine and you do not need your Postgres instance extremely hardened:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Possible solution #2
If you want to be very proactive, try dropping the database and dropping the role. Then recreate both. This way you ensure you have the correct username (aka role) and password.
To get to a SQL prompt, you may want to try to run these two commands:
sudo su postgres
pgsql
Then run these four SQL statements:
drop database foobar;
drop user jdoe;
create user jdoe with password 'goodpassword';
create database foobar with OWNER=jdoe;