[MapServer-users] das "PLUGIN -msplugin_mssql2008.dll" Problem bei Mapserver 8

Seth G sethg at geographika.co.uk
Sun Sep 22 13:26:54 PDT 2024


Hi,

I'd first try to get your Mapfile working using map2img (see https://mapserver.org/utilities/map2img.html), remembering to set the -conf parameter to point to your CONFIG file.

It looks like you are displaying data through MapScript, so once map2img is working you may want to share your quickmap_geometry.php script as the error shows:

D:\www\cgi-bin\ms5\quickmap_geometry.php(13): mapObj->draw() #1 {main} thrown in D:\www\cgi-bin\ms5\quickmap_geometry.php on line 13

I've created a pull request with updated docs for the MSSQL driver at https://github.com/MapServer/MapServer-documentation/pull/967

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika at mastodon.social

On Sat, Sep 21, 2024, at 11:13 AM, Liandres, Valeri wrote:
> Hello, Seth! Thank you for such a quick reply! We have tried the changes - key "mssql" in MAP and PLUGIN - in the config file. Unfortunately, a new error message appeared: "Failed to load dynamic Layer LIB: mssql".
> Here are my data:
> ------------------------------------------
> Environment Variables: MAPSERVER_CONFIG_FILE D:\WWW\cgi-bin\etc\mapserver.conf
> -----------------------------------------mapserver.conf----------------------
> CONFIG
>   ENV
>                MS_MAP_NO_PATH "foo" 
>   END
>   PLUGIN
>                "mssql" "d:\www\cgi-bin\ms5\msplugin_mssql2008.dll"              #  *New*
>   END
>   MAPS
>                MAP1 "d:/www/local-demo/local.map"
>   END
> END
> ----------------------------------------------------------------------------
> MAP
>   EXTENT 4.9159680 46.7707244 15.8416465 55.0837406
>   UNITS dd
>   LAYER
>    NAME "Bundeslaender"
>                CONNECTIONTYPE PLUGIN
>                *PLUGIN "mssql"*                             *# this should be the key used in the CONFIG file*
>   # PLUGIN "D:\www\cgi-bin\ms5\msplugin_mssql2008.dll"  
>    CONNECTION "server=SErvername;uid=_user;pwd=pass;database=DB;Integrated Security=false"
>    DATA "GEOMETRY_LL84 from GEOM_VG_BULA using unique ID using SRID=4326"
>    TYPE POLYGON
>    STATUS ON
> ..... 
>   END
> END
> --------------------------------------------------tabelle "GEOM_VG_BULA"---------------------------------------
> //                          Example query the table:"GEOM_VG_BULA"
> $sql = "SELECT ID, GEOMETRY_LL84.ToString() AS GeometryData FROM GEOM_VG_BULA Where ID = 9";
>  
> ID; NAME; TYPE; GEOMETRY_UTM32; GEOMETRY_GK3; GEOMETRY_LL84; GEOGRAPHY_LL84; LEV; MAXLEV; RS; RS_GEKUERZT; GF; SHAPE_LEN; SHAPE_AREA; VATER_ID;
> ID: 9 Geometry Spalte GEOMETRY_LL84: MULTIPOLYGON (((8.5046081667131244 53.228919296139416, 8.5058996910812716 53.2278613377389, ..............., 8.616166313122319 53.197993104637327)))
> --------------------------------------------------------------------------------------------------------------------------
> Error message: Fatal error: Uncaught Exception: msDrawMap(): Image handling error. Failed to draw layer named 'Bundeslaender'.;loadCustomLayerDLL: General error message.
> Failed to load dynamic Layer LIB: mssql;msGetSymbol(): General error message.
> *Can't load requested dynamic library*: mssql in D:\www\cgi-bin\ms5\quickmap_geometry.php:13
> Stack trace: #0 D:\www\cgi-bin\ms5\quickmap_geometry.php(13): mapObj->draw() #1 {main} thrown in D:\www\cgi-bin\ms5\quickmap_geometry.php on line 13
> I checked the permissions - full access What do you think is the cause?
> Best regards
> Valeri
>  
> *Von:* Seth G <sethg at geographika.co.uk> 
> *Gesendet:* Freitag, 20. September 2024 13:42
> *An:* Liandres, Valeri <Valeri.Liandres at leibniz-liag.de>; MapServer Users <mapserver-users at lists.osgeo.org>
> *Cc:* Agemar, Thorsten <Thorsten.Agemar at leibniz-liag.de>
> *Betreff:* Re: [MapServer-users] das "PLUGIN -msplugin_mssql2008.dll" Problem bei Mapserver 8
>  
> ACHTUNG!! Diese E-Mail erreicht Sie von einem Absender außerhalb der GZH-Infrastruktur. Bitte klicken Sie auf keine Links oder öffnen Sie keine E-Mail-Anhänge, falls Sie den Absender nicht kennen und nicht wissen, ob der Inhalt sicher ist.
>  
> Hi Valeri,
>  
> The docs at https://mapserver.org/input/vector/mssql.html#option-2-connect-through-mapserver-plugin are out of date since version 8 of MapServer.
> For all layers using a PLUGIN you have to add the plugin to your MapServer CONFIG file: https://mapserver.org/mapfile/config.html#config
>  
> For example:
>  
>   PLUGINS
>     "mssql" "d:\www\cgi-bin\ms5\msplugin_mssql2008.dll"
>   END
>  
> Then you use the key to the plugin in your Mapfile. This avoids MapServer loading possibly untrusted DLLs:
>  
>   LAYER
>    NAME "..."
>    CONNECTIONTYPE PLUGIN
>    PLUGIN "mssql" # this should be the key used in the CONFIG file - 
>    CONNECTION "server=ServName;uid=_user;pwd=pass;database=DB-Name;Integrated Security=false"
>    DATA "GEOMETRY_LL84 from GEOM_VG_BULA using unique ID using SRID=4326"
>    TYPE POLYGON
>    STATUS OFF
>  
> When using the Mapfile through MapScript you will need to pass the path to your CONFIG file. See https://github.com/MapServer/MapServer/pull/6646 for details.
>  
> This may resolve your current issue, unless you already use the DLL path a key, in which case it could be something else such as an extra double-quote in the CONNECTION string. 
>  
> Seth
>  
> --
> web:https://geographika.net & https://mapserverstudio.net
> mastodon: @geographika at mastodon.social
>  
> On Fri, Sep 20, 2024, at 12:08 PM, Liandres, Valeri via MapServer-users wrote:
>> Hello,
>> 
>> we are migrating our project with Mapserver 7 to Mapserver 8.0. Our project has been working stably under Mapserver 7 for a long time.
>> 
>> One component of the project is DB query MSSQL - Server using MAP file and PLUGIN routine.
>> 
>> Although we are using the latest version of "msplugin_mssql2008.dll", we always get an error message that the query is wrong. The table "GEOM_VG_BULA" and permissions are OK.
>> 
>> The call is in the PHP file as:
>> 
>> $oMap = new mapObj(MAPFILE);$oMap->setSize(1990, 1160);....    $oImage = $oMap->draw();
>> 
>> -------
>> 
>> MAP
>> 
>> ...
>> 
>>   LAYER
>> 
>>    NAME "..."
>> 
>>    CONNECTIONTYPE PLUGIN
>> 
>>    PLUGIN "d:\www\cgi-bin\ms5\msplugin_mssql2008.dll"
>> 
>>    CONNECTION "server=ServName;uid=_user;pwd=pass;database=DB-Name;Integrated Security=false"
>> 
>>    *DATA "GEOMETRY_LL84 from GEOM_VG_BULA using unique ID using SRID=4326"       <<<<<  *here table *GEOM_VG_BULA* , column *GEOMETRY_LL84*
>> 
>>    TYPE POLYGON
>> 
>>    STATUS OFF
>> 
>> ...
>> 
>> END
>> 
>> -------
>> 
>> The error message:
>> 
>> Fatal error: Uncaught Exception: msDrawMap(): Image handling error. Failed to draw layer named 'Bundeslaender'.;msMSSQL2008LayerOpen():
>> 
>>  *Query error*. Error with MSSQL2008 data variable. You specified 'Error parsing MSSQL2008 *data variable: nothing specified in DATA statement*.
>> 
>> <br><br> More Help:<br><br> '.<br> Standard ways of specifying are : <br> (1) 'geometry_column from geometry_table' <br> (2) 'geometry_column from (<sub query>) as foo using unique <column name> using SRID=<srid#>' <br><br> Make sure you utilize the 'using unique <column name>' and 'using with <index name>' clauses in. <br><br>For more help, please see http://www.mapdotnet.com <br><br>mapmssql2008.c - version of 2007/7/1. in D:\www\cgi-bin\ms5\quickmap_geometry.php:13
>> 
>>  Stack trace: #0 D:\www\cgi-bin\ms5\quickmap_geometry.php(13): mapObj->draw() #1 {main} thrown in D:\www\cgi-bin\ms5\quickmap_geometry.php on line
>> 
>>  
>> 
>> Is this a problem only with version 8.0?
>> 
>> Unfortunately, we cannot use "Connection type OGR" in our project structure.
>> 
>>  
>> 
>> Can anyone help us?
>> 
>> Valeri
>> 
>> _______________________________________________
>> MapServer-users mailing list
>> MapServer-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>  
>  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20240922/c30c5302/attachment.htm>


More information about the MapServer-users mailing list