Error Unable to obtain connection from database for user postgres SQL State : 08001

Vadym11Vadym11 Posts: 2 New member
I'm testing PostgreSQL with Flyway ( from docker-compose.yml ) and faced issue with connections on github actions, workflow fails

ERROR: Unable to obtain connection from database (jdbc:postgresql://db/a_site_to_order_stuff?sslmode=require) for user 'postgres': The connection attempt failed.

db - is the name of postgres service.
I also tried to connect my containers IP 

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name

Did not help me, same issue
Tagged:

Answers

  • Vadym11Vadym11 Posts: 2 New member

    I added to my workflow file:

    FLYWAY_URL=jdbc:postgresql://db:5432/test -e FLYWAY_USER=postgres -e FLYWAY_PASSWORD=postgres flyway migrate

    Successfully run my workflow


  • jack1111jack1111 Posts: 4 New member
    The error message "Unable to obtain connection from database for user postgres SQL State : 08001" typically indicates a problem with establishing a connection to the PostgreSQL database. It could be due to incorrect credentials, network issues, or the database server being unavailable. Troubleshooting should involve verifying connection parameters, network settings, and ensuring the PostgreSQL service is running and accessible.

  • jack1111jack1111 Posts: 4 New member
    thank you so much.
  • jack1111jack1111 Posts: 4 New member
    The error message "Unable to obtain connection from database for user postgres SQL State: 08001" indicates a connection issue with the database. SQL State 08001 typically points to a network-related problem or incorrect connection parameters (e.g., hostname, port, username, or password). Verify the database server's availability and ensure that the connection details are correct.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file