QGIS is an open-source Geographic Information System that allows users to visualize, analyze, and interpret spatial data on maps. It supports a wide range of file formats and offers various tools for data management and mapping.
PostGIS is a spatial database extender for PostgreSQL, adding support for geographic objects to the database. It allows users to store, query, and manage spatial data, making it a powerful tool for handling geospatial information in large-scale projects.

Once you open QGIS, the next step in connecting to PostGIS is creating a new database connection. To do this, right-click on the PostgreSQL section in the Browser panel and select “New Connection…“.
Alternatively, you can navigate to Layer > Add Layer and select “Add PostGIS Layer…” from the menu.

An alternative way to access the database connection function.

After selecting “New Connection“, the next step is to enter the required details to establish a successful database connection. In this example, a connection is being made to a database named water_network, using the following parameters:
- Name: water_network
- Host: localhost
- Port: 5432
- Database: water_network
For SSL mode, the option Disable is selected since this is a local connection (localhost), and SSL encryption is not required in this case.
Additionally, the option “Also list tables with no geometry” is enabled to ensure that QGIS displays both spatial data and attribute tables without geometric features.

The next step is to enter the required credentials in the Basic section by providing the Username and Password. After entering the details, clicking on Test Connection will verify the setup.
If the connection is successful, QGIS will display a confirmation message.

Once the connection is successfully established, the database will appear under PostgreSQL in the Browser panel. To access its contents, the user needs to connect to the database using the defined credentials.
After entering the login details, QGIS will display a list of layers and tables stored in the database. From there, spatial and attribute data can be loaded directly into the project.

