From: | Hemil Ruparel <hemilruparel2002(at)gmail(dot)com> |
---|---|
To: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | How to debug authentication issues in Postgres |
Date: | 2020-11-27 07:14:53 |
Message-ID: | CANW1aT9EGHqcj4Qc4e83fOS4MBNVUpL9vPf6nknBd__DmeBGfA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a remote database which I can connect to using psql command line
tool as well as PgAdmin4. But I would really like to use DataGrip. But
whenever I try to connect, it gives me fatal: password authentication
failed and prompts me for another password. I raised an issue in DataGrip
and I was told there is an issue in my database configuration.
Here is my pg_hba.conf:
```
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32
scram-sha-256
# IPv4 connections from internet
host database user 0.0.0.0/0 scram-sha-256
host database user 0.0.0.0/0 md5
host database user 0.0.0.0/0 password
# IPv6 local connections:
host all all ::1/128
scram-sha-256
# IPv6 connections from internet:
host database user ::0/0 scram-sha-256
host database user ::0/0 md5
host database user ::0/0 password
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all
```
Since I know a Java and I know Idea uses java, so I wrote this small
snippet to try to connect to my server using JDBC:
```java
public class Test {
public static void main(String[] args) throws SQLException {
Connection connection = DriverManager.getConnection(
"jdbc:postgresql://url/database",
"user",
"password"
);
try (connection) {
Statement statement = connection.createStatement();
statement.execute("select version()");
}
}
}
```
And it failed with the same error
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2020-11-27 07:54:44 | Re: How to debug authentication issues in Postgres |
Previous Message | Laurenz Albe | 2020-11-27 04:25:21 | Re: postgres_fdw insert extremely slow |