I need to connect to some PostgreSQL server providing some credentials, and print a list of available databases on that host for a given user.
I am trying:
You have to connect to a database. Which database you could use for a "maintenance database" depends on the installation and the subsequent administration. After a default installation there are 2 databases that could be used for the initial connection - "template1" and "postgres". It's wise to create a new user and a database with the same name and use those.