title: Add rows into Database table using Shell Script?
body: <p>How to add rows into table in the Database by Shell Script?
  I have following:</p>
  
  <pre><code>Postgres Database Name: dm
  Table Name: Error Codes
  Password of Database: ******
  </code></pre>
  
  <p>I want to add rows into table?</p>
  
  <p>I am just starting Shell Scripting...  </p>
  
  <p>My code:</p>
  
  <pre><code>#!/bin/sh
  DATABASE="dm"
  USERNAME="postgres"
  HOSTNAME="HBG"
  export PGPASSWORD="postgres"
  
  psql -h $HOSTNAME -U $USERNAME $DATABaSE &lt;&lt; EOF
  select * from Error Codes
  EOF
  </code></pre>
  
  <p>Getting error:</p>
  
  <pre><code>psql: could not connect to server: Connection refused
      Is the server running on host "HBG" (192.168.0.241) and accepting
      TCP/IP connections on port 5432?
  </code></pre>