A database is a storage component of a software solution. However, it does not just store information; it also ensures consistency when the data is properly modeled in relational structures. Additionally, a database can implement more complicated logic related to consistency, which goes beyond normalization, with triggers and rules. Of course, business logic can also be fulfilled by a database with functions written in PostgreSQL in PL/pgSQL or other languages supported by the DBMS. Implementation of business logic in a database is questionable from an architecture point of view, but this is outside the scope of this book.
Nevertheless, the tasks related to interaction with users or I/O cannot be performed by the database. External applications do this. In this chapter, you will learn how to connect and interact with a database from an external...