PostgreSQL service

PostgreSQL service

The original version of this document is located at at https://docs.qfield.org/how-to/pg-service

PostgreSQL service

A pg_service.conf file allows to use an named alias for a PostgreSQL server connection. Instead of storing hostname, port, database name and more into the QGIS Project file, these can be stored separately. It is even possible to store username and password in a pg_service.conf file, to avoid having this stored in clear text in the QGIS Project.

Read more about PostgreSQL services in the QGIS documentation.

QField - Direct Connection

If you directly connect from QGIS to your database you can make use of a pg_service.conf file by placing it in the QField data folder. You can place your file either on the Internal Device Storage or on the SD Card Storage. You can check the path for the QField data folder in the bottom of the About QField screen in the app.

Usually the path on Android devices looks something like this: /Android/data/ch.opengis.qfield/files/QField.

!!! note Unlike on *NIX systems where the file is named .pg_service.conf, the file on Android is named pg_service.conf without a leading dot sign (.).

QFieldCloud

QFieldCloud support pg_service.conf configurations too. You need to configure your PostgreSQL layers with "Offline editing" cloud action and store your service settings on QFieldCloud Project's Secrets page.

Read more how to configure PostgreSQL service in the QFieldCloud documentation.

    • Related Articles

    • Secrets

      The original version of this document is located at at https://docs.qfield.org/reference/qfieldcloud/secrets Secrets Secrets are settings that are securely stored in an encrypted way. Project's jobs will automatically have access to their secrets. ...
    • Jobs

      The original version of this document is located at at https://docs.qfield.org/reference/qfieldcloud/jobs secrets). !!! note All jobs can be triggered using the QFieldCloud API. !!! warning - Any of the triggering conditions described on this page ...
    • Technical specs

      The original version of this document is located at at https://docs.qfield.org/reference/qfieldcloud/specs Firewall configuration If a project contains online layers (PostGIS, WMS, WFS, etc), QFieldCloud will try to establish a connection to this ...
    • Projects

      The original version of this document is located at at https://docs.qfield.org/reference/qfieldcloud/projects Creating a project A project can be created in two different ways: either using the QFieldCloud web interface or using QFieldSync in QGIS. ...
    • FAQ

      The original version of this document is located at at https://docs.qfield.org/get-started/faq Frequently Asked Questions ??? help "How many versions of a file are stored on QFieldCloud?" ## How many versions of a file are stored on QFieldCloud? The ...