[mapserver-users] Same database connection across multiple layers

2022-05-13 Thread Atlanta Geek
Is there a way to set the db connection only once for multiple layers.
We have a very dynamic mapfile with lots of layers and its a pain to
replace the db name when doing development or changing for a customer.  We
are running ms4w as well.


In addition to this is it possible to set the connection string outside the
mapfile.  Maybe as an option to the cgi script or something.

-- 
http://www.atlantageek.com
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Same database connection across multiple layers

2022-05-13 Thread Rahkonen Jukka
Hi,

Write the connection into a separate file that you can INCLUDE into the main 
mapfile  https://mapserver.org/mapfile/include.html

-Jukka Rahkonen-

Lähettäjä: MapServer-users  Puolesta 
Atlanta Geek
Lähetetty: perjantai 13. toukokuuta 2022 16.14
Vastaanottaja: mapserver-users@lists.osgeo.org
Aihe: [mapserver-users] Same database connection across multiple layers

Is there a way to set the db connection only once for multiple layers.
We have a very dynamic mapfile with lots of layers and its a pain to replace 
the db name when doing development or changing for a customer.  We are running 
ms4w as well.


In addition to this is it possible to set the connection string outside the 
mapfile.  Maybe as an option to the cgi script or something.

--
http://www.atlantageek.com
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Same database connection across multiple layers

2022-05-13 Thread Richard Greenwood
Use INCLUDE 'pgconn.map'

With pgconn.map looking like:

CONNECTIONTYPE postgis
CONNECTION "user=USER password=PASSWORD dbname=DATABASE host=127.0.0.1
port=5432"
PROCESSING "CLOSE_CONNECTION=DEFER"


On Fri, May 13, 2022 at 7:14 AM Atlanta Geek  wrote:

> Is there a way to set the db connection only once for multiple layers.
> We have a very dynamic mapfile with lots of layers and its a pain to
> replace the db name when doing development or changing for a customer.  We
> are running ms4w as well.
>
>
> In addition to this is it possible to set the connection string outside
> the mapfile.  Maybe as an option to the cgi script or something.
>
> --
> http://www.atlantageek.com
> ___
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Richard W. Greenwood
www.greenwoodmap.com
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Same database connection across multiple layers

2022-05-13 Thread Atlanta Geek
So I would put the INCLUDE in all the layers, correct?

On Fri, May 13, 2022 at 11:05 AM Richard Greenwood <
richard.greenw...@gmail.com> wrote:

> Use INCLUDE 'pgconn.map'
>
> With pgconn.map looking like:
>
> CONNECTIONTYPE postgis
> CONNECTION "user=USER password=PASSWORD dbname=DATABASE host=127.0.0.1
> port=5432"
> PROCESSING "CLOSE_CONNECTION=DEFER"
>
>
> On Fri, May 13, 2022 at 7:14 AM Atlanta Geek 
> wrote:
>
>> Is there a way to set the db connection only once for multiple layers.
>> We have a very dynamic mapfile with lots of layers and its a pain to
>> replace the db name when doing development or changing for a customer.  We
>> are running ms4w as well.
>>
>>
>> In addition to this is it possible to set the connection string outside
>> the mapfile.  Maybe as an option to the cgi script or something.
>>
>> --
>> http://www.atlantageek.com
>> ___
>> MapServer-users mailing list
>> MapServer-users@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
>
> --
> Richard W. Greenwood
> www.greenwoodmap.com
>


-- 
http://www.atlantageek.com
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Same database connection across multiple layers

2022-05-13 Thread Richard Greenwood
Yep.

On Fri, May 13, 2022 at 9:52 AM Atlanta Geek  wrote:

> So I would put the INCLUDE in all the layers, correct?
>
> On Fri, May 13, 2022 at 11:05 AM Richard Greenwood <
> richard.greenw...@gmail.com> wrote:
>
>> Use INCLUDE 'pgconn.map'
>>
>> With pgconn.map looking like:
>>
>> CONNECTIONTYPE postgis
>> CONNECTION "user=USER password=PASSWORD dbname=DATABASE host=127.0.0.1
>> port=5432"
>> PROCESSING "CLOSE_CONNECTION=DEFER"
>>
>>
>> On Fri, May 13, 2022 at 7:14 AM Atlanta Geek 
>> wrote:
>>
>>> Is there a way to set the db connection only once for multiple layers.
>>> We have a very dynamic mapfile with lots of layers and its a pain to
>>> replace the db name when doing development or changing for a customer.  We
>>> are running ms4w as well.
>>>
>>>
>>> In addition to this is it possible to set the connection string outside
>>> the mapfile.  Maybe as an option to the cgi script or something.
>>>
>>> --
>>> http://www.atlantageek.com
>>> ___
>>> MapServer-users mailing list
>>> MapServer-users@lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>>
>> --
>> Richard W. Greenwood
>> www.greenwoodmap.com
>>
>
>
> --
> http://www.atlantageek.com
>


-- 
Richard W. Greenwood
www.greenwoodmap.com
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users