How to add rows into table in the Database by Shell Script? I have following:
Postgres Database Name: dm
Table Name: Error Codes
Password of Database: ******
I want to add rows into table?
I am just starting Shell Scripting...
My code:
#!/bin/sh
DATABASE="dm"
USERNAME="postgres"
HOSTNAME="HBG"
export PGPASSWORD="postgres"
psql -h $HOSTNAME -U $USERNAME $DATABaSE << EOF
select * from Error Codes
EOF
Getting error:
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?