title: Postgresql : Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
body: <p>I am trying to connect postgresql but I am getting this error.</p>
  
  <pre><code>org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
  </code></pre>
  
  <p>My pg_hba.conf file is like this.</p>
  
  <pre><code> TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD
  
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            md5
  # IPv6 local connections:
  host    all             all             ::1/128                 md5
  </code></pre>
  
  <p>I would be much obliged if anyone please be so kind enough to explain whats hoing on here and how should I correct it.</p>