<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Hi,</p>
<p>Sorry, writing in English.</p>
<p>Thanks for your feedbacks !</p>
<p>I'm aware it's not easy to fully use service file.</p>
<p></p>
<p>It's indeed strange, but the documentation about "PostgreSQL
service" is better on qgis.org website than PostgreSQL website ...</p>
<p><a class="moz-txt-link-freetext" href="https://www.postgresql.org/docs/current/libpq-pgservice.html">https://www.postgresql.org/docs/current/libpq-pgservice.html</a></p>
<p><a class="moz-txt-link-freetext" href="https://docs.qgis.org/3.34/en/docs/user_manual/managing_data_source/opening_data.html#postgresql-service-connection-file">https://docs.qgis.org/3.34/en/docs/user_manual/managing_data_source/opening_data.html#postgresql-service-connection-file</a></p>
<p>Please do not hesitate to submit a PR on the QGIS documentation
website :</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS-Documentation/blob/master/docs/user_manual/managing_data_source/opening_data.rst#postgresql-service-connection-file">https://github.com/qgis/QGIS-Documentation/blob/master/docs/user_manual/managing_data_source/opening_data.rst#postgresql-service-connection-file</a>
(there is a small pen icon)</p>
<p>to rephrase or add a note.</p>
<p>> <span lang="EN-US">«Prevent PostgresSQL layers from using a
service file» waren die Checks OK. (Komischer Check!)</span></p>
<p><span lang="EN-US">Indeed ! :)</span></p>
<p><span lang="EN-US">We DO recommend using a service file, but it
needs a step on server as you understood :) That's why it gives
a hint that it's not "out of the box".</span></p>
<p><span lang="EN-US">Cheers<br>
</span></p>
<p><br>
</p>
<div class="moz-cite-prefix">On 04/04/2024 14:06, Petert Berger via
Lizmap-de wrote:<br>
</div>
<blockquote type="cite"
cite="mid:00b901da8688$8bb5c270$a3214750$@bluewin.ch">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"Open Sans";}@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}@font-face
{font-family:Lato;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}h2
{mso-style-priority:9;
mso-style-link:"Überschrift 2 Zchn";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:18.0pt;
font-family:"Calibri",sans-serif;
font-weight:bold;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}code
{mso-style-priority:99;
font-family:"Courier New";}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.E-MailFormatvorlage21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}span.berschrift2Zchn
{mso-style-name:"Überschrift 2 Zchn";
mso-style-priority:9;
mso-style-link:"Überschrift 2";
font-family:"Calibri",sans-serif;
font-weight:bold;}span.productname
{mso-style-name:productname;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}div.WordSection1
{page:WordSection1;}ol
{margin-bottom:0cm;}ul
{margin-bottom:0cm;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hallo
zusammen<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Ich
möchte euch noch gerne meine Erfahrungen mit dem der
pg_service.conf teilen. Dabei beziehe ich mich auf Linux. Es
ist nämlich etwas tricky.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Offiziell
findet man in der Postgres-Dokumentation dies:<o:p></o:p></span></p>
<h2
style="mso-margin-top-alt:12.0pt;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm"><span
style="font-size:17.5pt;font-family:"Open Sans",sans-serif"
lang="EN-US">The Connection Service File <o:p></o:p></span></h2>
<p
style="margin-top:0cm;box-sizing: border-box;margin-bottom:1rem;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);-webkit-text-size-adjust: 100%"><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">The connection service file allows libpq
connection parameters to be associated with a single service
name. That service name can then be specified in a libpq
connection string, and the associated settings will be used.
This allows connection parameters to be modified without
requiring a recompile of the libpq-using application. The
service name can also be specified using the </span><code><span
style="font-size:9.0pt" lang="EN-US">PGSERVICE</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US"> environment variable.<o:p></o:p></span></p>
<p style="margin-top:0cm"><a name="id-1.7.3.24.2"
moz-do-not-send="true"></a><a name="id-1.7.3.24.3"
moz-do-not-send="true"></a><a name="id-1.7.3.24.4"
moz-do-not-send="true"></a><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">Service names can be defined in either a
per-user service file or a system-wide file. If the same
service name exists in both the user and the system file,
the user file takes precedence. By default, the per-user
service file is named </span><code><span
style="font-size:9.0pt" lang="EN-US">~/.pg_service.conf</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">. On Microsoft Windows, it is named </span><code><span
style="font-size:9.0pt" lang="EN-US">%APPDATA%\postgresql\.pg_service.conf</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">(where </span><code><span
style="font-size:9.0pt" lang="EN-US">%APPDATA%</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US"> refers to the Application Data subdirectory in
the user's profile). A different file name can be specified
by setting the environment variable </span><code><span
style="font-size:9.0pt" lang="EN-US">PGSERVICEFILE</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">. The system-wide file is named </span><code><span
style="font-size:9.0pt" lang="EN-US">pg_service.conf</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">. By default it is sought in the </span><code><span
style="font-size:9.0pt" lang="EN-US">etc</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US"> directory of the <span class="productname">PostgreSQL</span> installation
(use </span><code><span style="font-size:9.0pt" lang="EN-US">pg_config
--sysconfdir</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US"> to identify this directory precisely). Another
directory, but not a different file name, can be specified
by setting the environment variable </span><code><span
style="font-size:9.0pt" lang="EN-US">PGSYSCONFDIR</span></code><span
style="font-size:9.0pt;font-family:"Open Sans",sans-serif"
lang="EN-US">.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Meine
Erfahrungen:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
style="mso-fareast-language:EN-US">Zuerst habe ich mir in
der User <span style="background:lime;mso-highlight:lime">HOME-Verzeichnis
ein </span></span><code><span
style="font-size:10.0pt;background:lime;mso-highlight:lime">~/.pg_service.conf</span></code><code><span
style="font-size:10.0pt"> </span></code><span
style="mso-fareast-language:EN-US">File angelegt. Dann hat
es in QGIS funktioniert. In QGIS muss man dann eigentlich
in den PostgeSQL-Settings nur den Service eintragen und es
funktioniert.<o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
style="mso-fareast-language:EN-US">Dann habe ich Lizmap
geöffnet und da meckert Lizmap bei den Checks. </span><span
style="mso-fareast-language:EN-US" lang="EN-US">Nach
Abschalten in den Services, </span><span lang="EN-US">«Prevent
PostgresSQL layers from using a service file» waren die
Checks OK. (Komischer Check!)</span><span
style="mso-fareast-language:EN-US" lang="EN-US"><o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1">Im Web war
dann der Postgres-Layer wiederum nicht zu sehen. Hmm.. Dann
die Erleuchtung, dass der QGIS-Server ja nicht als gleicher
User läuft und somit er das <code><span
style="font-size:10.0pt">~/.pg_service.conf File </span></code>im
Verzeichnis des anderen User nicht sieht. Also müsste ich
das File an mehreren Ort haben. Nicht praktikabel!<o:p></o:p></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1">Ich habe
dann entschieden, dass ich das Ganze systemweit verfügbar
mache indem ich <code><span style="font-size:10.0pt">pg_config
–sysconfdir </span></code>aufrufe. Da kommt dies raus<code><span
style="font-size:10.0pt"> /etc/postgresql-common</span></code>.
Nun habe ich das File <code><span style="font-size:10.0pt">~/.pg_service.conf
</span></code>in diesen Ordner kopiert. Funktionierte
nicht! Hmm… Aha, das File hat dort einen anderen Namen nicht
<code><span
style="font-size:10.0pt;background:red;mso-highlight:red">~/.pg_service.conf</span></code><code><span
style="font-size:10.0pt"> </span></code>sondern <code><span
style="font-size:10.0pt;background:lime;mso-highlight:lime">~/pg_service.conf</span></code>.
Also ohne führenden Punkt. Nun hat es funktioniert!<span
style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1">Man kann den
Bezug auf das File auch in der Environment
Variable PGSERVICEFILE definieren. Ob das funktioniert habe
ich bis jetzt nicht ausprobiert. Hat jemand Erfahrung damit?<o:p></o:p></li>
</ul>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Etwas
mühsam ist dies jedoch, wenn man ein QGIS-File auf einem
System ohne Postgreszugang aufruft. Dann funktionieren die
Postgres-Layer nicht.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Gruss,
Peter<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div
style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE">Von:</span></b><span
lang="DE"> Lizmap-de
<a class="moz-txt-link-rfc2396E" href="mailto:lizmap-de-bounces@lists.osgeo.org"><lizmap-de-bounces@lists.osgeo.org></a> <b>Im Auftrag
von </b>Peter Berger via Lizmap-de<br>
<b>Gesendet:</b> Donnerstag, 28. März 2024 14:53<br>
<b>An:</b> Jörg Thomsen
<a class="moz-txt-link-rfc2396E" href="mailto:joerg.thomsen@wheregroup.com"><joerg.thomsen@wheregroup.com></a><br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:lizmap-de@lists.osgeo.org">lizmap-de@lists.osgeo.org</a><br>
<b>Betreff:</b> Re: [Lizmap-de] Lizmap Rechte für
Postgres-Layer direkt in das QGIS-File einbinden<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hallo Jörg<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Vielen Dank für deinen Beitrag. Wir haben
also diese Möglichkeiten: <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Die Credentials in ein dezidiertes File
einzubinden, pg_service.conf.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In ein QGIS-File händisch pro Layer
einzutragen.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Und via QGIS in einer Konfiguration
einzutragen. Dies funktioniert bei mir jedoch nicht! Sollte
doch? Hat QGIS, mindestens bei den 3.34.x Versionen einen
Bug?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Wie immer, das mit dem pg_service.conf
funktioniert. Ich werde in Zukunft diesen Weg gehen. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Liebe Grüsse<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Peter<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">Am
28.03.2024 um 08:42 schrieb Jörg Thomsen via Lizmap-de
<<a href="mailto:lizmap-de@lists.osgeo.org"
moz-do-not-send="true" class="moz-txt-link-freetext">lizmap-de@lists.osgeo.org</a>>:<o:p></o:p></p>
</blockquote>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Moin,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">ein Zwischenruf von der Seite.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p>> Da ist zwar noch ein weiteres File dabei, ich hab
aber nie rausgefunden, wofür das ist. <o:p></o:p></p>
<p><a
href="https://docs.qgis.org/3.16/de/docs/user_manual/appendices/qgis_file_formats.html"
moz-do-not-send="true" class="moz-txt-link-freetext">https://docs.qgis.org/3.16/de/docs/user_manual/appendices/qgis_file_formats.html</a>
-><o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Lato",sans-serif;color:#404040;background:#FCFCFC">Die <strong><span
style="font-family:"Lato",sans-serif">QGD</span></strong>-Datei
ist die zugehörige Sqlite-Datenbank des
qgis-Projekts, die Hilfsdaten für das Projekt
enthält. </span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Für postgis schick in in den
nächsten Tagen nochmal was. Wir haben das bei uns
immer mit einem service definitions file gelöst.<o:p></o:p></p>
</div>
</div>
</blockquote>
<p><a
href="https://wheregroup.com/blog/details/einfache-verbindung-von-postgresql-postgis-datenbanken-mit-qgis-mittels-mit-pg-serviceconf/"
moz-do-not-send="true" class="moz-txt-link-freetext">https://wheregroup.com/blog/details/einfache-verbindung-von-postgresql-postgis-datenbanken-mit-qgis-mittels-mit-pg-serviceconf/</a><o:p></o:p></p>
<p>Viele Grüße, Jörg<o:p></o:p></p>
<p>---------------------------------------------<br>
Schon gewusst?<span
style="font-family:"Tahoma",sans-serif">
</span><br>
In unserem Blog geben wir Tipps & Tricks zu
Open-Source-GIS-Software <br>
und berichten aus unserem Experten-Alltag:<br>
<a href="https://wheregroup.com/blog/"
moz-do-not-send="true" class="moz-txt-link-freetext">https://wheregroup.com/blog/</a><br>
---------------------------------------------<br>
<br>
<br>
Jörg Thomsen<br>
WhereGroup GmbH<br>
Bundesallee 23<br>
10717 Berlin<br>
Germany<br>
<br>
Tel: +49 (0)30 / 5130 278 74<br>
Fax: +49 (0)30 / 5130 278 11 <br>
<br>
<a href="mailto:joerg.thomsen@wheregroup.com"
moz-do-not-send="true" class="moz-txt-link-freetext">joerg.thomsen@wheregroup.com</a><br>
<a href="http://www.wheregroup.com"
moz-do-not-send="true">www.wheregroup.com</a><br>
<br>
Geschäftsführer:<br>
Olaf Knopp, Peter Stamm<br>
Amtsgericht Bonn, HRB 9885<br>
<br>
-------------------------------<br>
Folgen Sie der WhereGroup auf twitter: <a
href="http://twitter.com/WhereGroup_com"
moz-do-not-send="true" class="moz-txt-link-freetext">http://twitter.com/WhereGroup_com</a><o:p></o:p></p>
<p class="MsoNormal"><span lang="FR-CH">-- <br>
Lizmap-de mailing list<br>
</span><a href="mailto:Lizmap-de@lists.osgeo.org"
moz-do-not-send="true"><span lang="FR-CH">Lizmap-de@lists.osgeo.org</span></a><span
lang="FR-CH"><br>
</span><a
href="https://lists.osgeo.org/mailman/listinfo/lizmap-de"
moz-do-not-send="true"><span lang="FR-CH">https://lists.osgeo.org/mailman/listinfo/lizmap-de</span></a><span
lang="FR-CH"><o:p></o:p></span></p>
</div>
</blockquote>
</div>
</div>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top: 1px solid #D3D4DE;">
<tbody>
<tr>
<td style="width: 55px; padding-top: 13px;"><a
href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank" moz-do-not-send="true"><img
src="https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif"
alt="" style="width: 46px; height: 29px;"
moz-do-not-send="true" width="46" height="29"></a></td>
<td
style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virenfrei.<a
href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank" style="color: #4453ea;"
moz-do-not-send="true">www.avast.com</a></td>
</tr>
</tbody>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
height="1" moz-do-not-send="true"> </a></div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
<div class="moz-signature">-- <br>
<p> <span style="font-weight:bold;color:#9ACD32;">Etienne
Trimaille</span> <br>
Géomaticien <br>
<a href="http://www.3liz.com"
style="text-decoration: none; color: #9ACD32;">www.3liz.com</a>
<br>
<span style="font-size:0.8em;"> <br>
<b>Tel.</b> 06 12 93 11 39 <br>
<b>Bureau</b> <br>
31, rue de l'Argenterie <br>
34000 Montpellier <br>
<b>Siège social</b> <br>
73, allée Kleber <br>
Boulevard de Strasbourg <br>
34000 Montpellier </span>
</p>
<p><br>
</p>
</div>
<div id="grammalecte_menu_main_button_shadow_host"
style="width: 0px; height: 0px;"></div>
</body>
<lt-container></lt-container>
</html>