getMessage(); } ?>In this example, we are using the PDO extension to connect to a PostgreSQL database. The host, username, password and database name are passed as parameters to the PDO constructor. The package library used in this example is the PDO PostgreSQL driver, which is also included in PHP by default.