PostgresDB 08003: Connection does not exist

When an operation is attempted on a non-existent connection.
  1. Check if the PostgreSQL service is running:
    • For Linux: sudo systemctl status postgresql
    • For Windows: Open Services (services.msc from Run), and check if the PostgreSQL service is running.
  2. Verify connectivity to the PostgreSQL server:
    • Use psql command: psql -h hostname -U username -d databasename replacing hostname, username, and databasename with your actual server details.
  3. Review PostgreSQL server logs for any errors or warnings that could indicate why connections are being refused or dropped. The log location varies, but you can usually find it in the PostgreSQL data directory, often named postgresql.log or within a log directory.
  4. Check for any firewall rules that might be blocking connections to the PostgreSQL port (default is 5432):
    • For Linux, use sudo iptables -L to list firewall rules.
    • For Windows, check the inbound rules in Windows Firewall.
  5. Ensure the postgresql.conf and pg_hba.conf files are correctly configured to allow connections:
    • For postgresql.conf, check the listen_addresses and port directive.
    • For pg_hba.conf, ensure your client's IP and connection method (e.g., host, hostssl) are correctly specified.
  6. Try restarting the PostgreSQL service to resolve any transient issues:
    • For Linux: sudo systemctl restart postgresql
    • For Windows: Restart the service from Services (services.msc).
  7. If using a connection pooler (e.g., PgBouncer), ensure it is correctly routing connections to the PostgreSQL server and is not misconfigured or down.
  8. Check the server's resources (CPU, RAM, disk space) to ensure it's not under heavy load or running out of resources, which could reject new connections. Use system monitoring tools:
    • For Linux: commands like top, htop, df, and free.
    • For Windows: Task Manager or Resource Monitor.
  9. Verify that the database you're trying to connect to exists and is accessible:
    • Connect to PostgreSQL with a superuser or a user with adequate privileges and list all databases: psql -U username -l.
  10. If the issue persists, consider restarting your client machine or checking for any network issues that might be affecting connectivity to the server.

Master

PostgresDB

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

PostgresDB

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid