[Mapserver-users] Changing PostGIS connection string on the fly

Jan Hartmann jhart at frw.uva.nl
Wed Feb 18 08:31:54 EST 2004


David Mitchell wrote:
> I have a layer that connects to a postgis datasource. In a file with ~30 
> layers, it can get tedious having to go through every layer and change 
> the connection string by hand (yes, search and replace works fine, but 
> there has to be a better way). I want to be able to set the connection 
> string dynamically.
> 
> I've tried using the cgi variable like so:
> 
> ...&map_water_connection=%22user=postgres+dbname=world+host=dbserver%22
> 
> and in a number of variations on the theme, but to no avail. Ideas?
> 

I'm not sure if the problem lies in the CONNECTION string. The "DATA" 
statement is protected in the newer releases of MapServer: you have to 
set a DATAPATTERN to change DATA by a CGI variable. This was done for 
security reasons. I don't think the same was done for "CONNECTION" 
although is would make sense to do so. Anyway, try setting DATAPATTERN 
to .* in the MAP section of your MapFile. This will make the DATA 
statement accessible for every possible change by a CGI variable and 
perhaps it will solve your problem too.


Jan




More information about the mapserver-users mailing list