Heroku postgres connection failed because of password auth - postgresql

I want to connect to the heroku postgres database I have set up using spring boot java. But before that I wanted to try and connect using pgAdmin 4. When I tried this I got an error saying the authentication for the 'username' had failed.
Then I started adding the database to my application.proporties file in spring boot to test it there. I got the samen error message.
This is the error message I got in spring boot: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "username".
I then even tried it in DBeaver. But still the same error.
heroku postgres credentials
application.properties in spring boot java
I checked multiple times if the password and username are the same. I really don't know what to do now, because I can't find any documantation on the heroku website

I'm NO EXPERT but I did have the same problem. I think I fixed it on the page with fields for Host, Port, Maintenance database, Username, Password, ... and then by toggling "save password."

Related

Not able to make postgres database call on heroku using Play Framework Application

I am build REST api using play framework 2.8 , I am able to start the application and call some service. Facing issue when trying to connecting with postgres database. Logs are below -
Error opening connection for database: {}org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "3.87.112.32", user "abc", database "xyz", SSL off
Tried looking solution for this and foudn have to add sslmode=require in query param while connection to database.
When log the url sslmode is already mentioned.
jdbc:postgresql://abc.amazonaws.com:5432/xyz?password=1234&sslmode=require&user=xyz
I am reading this property from heroku env variable JDBC_DATABASE_URL for obtaining database connection.
This issue can be fixed by adding addition query parameters apart from sslmode=require which are ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory after adding this the new URL become jdbc:postgresql://abc.amazonaws.com:5432/xyz?password=1234&sslmode=require&user=xyzssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

java.net.UnknownHostException: when trying to connect to heroku postgres through intellij

I have just signed up to a free heroku account hoping to try and see if a web app I am making functions properly, all works fine on my local machine connected locally to my postgres db.
I am trying to connect to the heroku postgres db I set up. I have connected fine through pgadmin and also in the application.yaml file so that when in prod profile, it runs on the heroku postgres database.
But if I try and connect to the DB using the intellij database connection, I keep getting an error,
[08001] The connection attempt failed. java.net.UnknownHostException: ec2-54-73-110-26.eu-west-1.compute.amazonaws.com
I have checked everything several times, and all the fields on the database connection wizard are correct. I have also set ssl to true, sslmode to verify-ca and sslfactory to sslfactory:org.postgresql.ssl.NonValidatingFactory
but I get the above error each time.

Not Connected to Server Postgres database , showing timeout expired

I am currently working on Spring Boot project which is connected to Postgres database. I am using PG Admin tool to connected to database. While I am running my project, I am getting exception and that is related to database.
The password I am giving is correct, still it is not connecting to the database. I am not using any AWS services.
How I can resolve this issues related to timeout expired?

Springboot build executable jar failed

I've got an error message like this while building executable jar in IntelliJ, using Maven Projects -> Lifecycle -> package
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
but when i put my local postgres password in hibernate.cfg it works.
Why building jar must connect to database to work?
The problem is my local postgres and server postgres password are not the same, i can change my local postgres to have same password, but it will be a problem if i have multiple server with different password for different project.
If you use application.properties you must set up the connection like this:
spring.datasource.url=jdbc:postgresql://localhost:5432/yourdb
spring.datasource.username=postgres
spring.datasource.password=sql
spring.datasource.driver-class-name=org.postgresql.Driver

Laravel 5 + Postgresql Connection

I have some problem in Postgre SQL, i can't connect my project Laravel 5 into Postgre SQL(i'm using PG Admin III), of course i remember the password in the first time i installed the Postgresql. but i think the problem is default username for database PostgreSQL, i try use "root",and "postgres" but both is failed. maybe someone know a default username for postgresql
PS: i've already configuring default into pgsql in database.php file and .env file
note: the error is (i tried in tinker laravel) "PDO exception with message could not find any driver"