Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can sоmеbody explain me what to write in the "service" box when connecting to the local DB.

QGIS Lisboa and Postgres are installed.

share|improve this question

What does the “service” box in the PostGIS connection dialog stand for?:

The service entry allows you to specify a service file that contains the connection parameters needed to access a certain postgresql database.

By having a service file, you can then ignore having to enter other details like database, host, port, user and password.

Here are some of the options you can include in a service file.

Can sоmеbody explain me what to write in the "service" box when connecting to the local DB.:

So unless you've got some service files made up, you don't need to enter anything - leave it blank.

I use service files so that individuals who couldn't be bothered to remember server details can easily connect when needed. It's easier for me to say, "please enter xyz into the service box and press OK."

There's also the option to save those connection details to an xml file from QGIS using the "save/load" buttons from the initial "Add PostGIS Layer" screen.

share|improve this answer

I usually keep it empty.

You just need to enter a Name for the connection, Host (either IP or hostname of the database server), Posrt, Database, userName and password.

That is more than sufficient to connect to the PostGIS database.

share|improve this answer
Name: (Any)
Host:localhost (or IP) 
Port:5432 (5432 is postgres default port)
Database:postgis20 (yours may be different)  
Username:postgres (yours may be different)    

enter image description here

check your pg_hba.conf allows you to connect



# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5
share|improve this answer

In your postgres-directory(e.g. C:\Program Files\PostgreSQL\9.3\ ) you will find a subdirectory called "share". There you can find the sample-file "pg_service.conf.sample". Create a Service-Definition here like this:


Save this file as ".pg_service.conf" (the dot at the beginning of the filename is important!) and copy it to %APPDATA%\postgresql\ (you can past this path into Windows-Explorer). You will end up in a folder like C:\Users\thomas\AppData\Roaming\postgresql

Restart the PostgreSQL-Service to reload the configuration.

Now you can create a new PostGIS-Connection in QGIS just by using a service name.

Tested on a Win7 machine and works like a charme. Very useful if you want to switch from testing- to production-database-server without having to change the QGIS-Project-Files. Just change the connection parameters in the service file and there you are.

best wishes, Thomas

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.