C:\Users\Your Name>python demo_pgsql_connection.py
Opened database successfully
Now you can start querying the database using SQL statements.
NOTE:
user - The username you use to work with PostgreSQL, The default username for the PostgreSQL database is postgres.
password - Password is given by the user at the time of installing the PostgreSQL.
host - Host name is the server name or Ip address on which PostgreSQL is running. if you are running on localhost, then you can use localhost, or it’s IP i.e., 127.0.0.0
database - Database name to which you want to connect. Here we are using Database named “books”.