[postgis-users] "service" field in postgres

Andreas Neumann a.neumann at carto.net
Thu Oct 11 13:53:05 PDT 2012


Hi,

The service field allows to tie a connection to a service name instead
of to a fixed hostname/port connection. If you want to move around QGIS
projects between different machines (sometimes the database is on local
host, sometimes it is in production environment on a dedicated db
server), it is convenient if you don't do connection to a server, but to
a service.

A service is defined in a specific file (/etc/pg_service.conf). The
location is specified in the environment variable "PGSYSCONFDIR". In a
service you define host, port and database, e.g. on a development machine:

[pg_switzerland]
host=localhost
port=5432
dbname=switzerland


in the production environment on a different machine it would be

[pg_switzerland]
host=mydedicateddbserver
port=5432
dbname=switzerland


Normally you would have to edit the .qgs file when you move to different
connection, but if you connect to a service instead of a host/port/db
combo, you can easily move the projects around.

See also http://www.postgresql.org/docs/current/static/libpq-pgservice.html

Hope this helps,
Andreas


Am 11.10.2012 19:17, schrieb Sandro Santilli:
> On Thu, Oct 11, 2012 at 06:05:10PM +0530, chathura silva wrote:
>> hi all,
>>
>> when I try to connect postgresQL via Quantumgis (QGIS) , it asks for a
>> service field to connect to the server. What is the value of the field
>> "service" ??
> 
> You can leave that field blank. I've actually no idea what it is used for.
> 
> --strk;
> 
>  http://www.cartodb.com - Map, analyze and build applications with your data
> 
>                                        ~~ http://strk.keybit.net 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list