[mapserver-users] Mapserver - connection to MSSQL

Robert Sanson Robert.Sanson at asurequality.com
Tue May 10 14:54:28 PDT 2016


Hi

I am trying to create a Mapserver (v 6.4.1 on Ubuntu) layer based on a MSSQL table with native geometry.

I have tested the connection via ogrinfo (based on gdal v 2.0.2) and it works:

ogrinfo -sql "select * from par_table where par_no = 6777887" "MSSQL:driver=FreeTDS;server=myserver,1433;uid=xx;pwd=xxx;database=mydb;trusted_connection=no;tables=par_table(geom)"

This is my layer section:

LAYER
  NAME par_direct
  GROUP "CRS"
  STATUS ON
  CONNECTIONTYPE ogr
  CONNECTION "MSSQL:driver=FreeTDS;server=myserver,1433;uid=xx;pwd=xxx;database=mydb;trusted_connection=no;tables=par_table(geom)"
  FILTER "WHERE date_dropped is null"
  TYPE POLYGON
  PROCESSING 'CLOSE_CONNECTION=DEFER'
  MAXSCALE 275000
  CLASS
    STYLE
      WIDTH 0.25
      OUTLINECOLOR 0 0 255
    END
  END
  METADATA
    "ows_title" "par_direct"
    "wms_group_title" "CRS"
    "wms_exceptions_format" "application/vnd.ogc.se_xml"
    "wms_abstract"    "This is the LINZ parcel layer in NZTM"
    "wms_keywordlist"    "LINZ,CRS"
    "wms_extent" "1114412.940 4793178.168 2089186.204 6190213.601"
    "gml_include_items"     "all"
    "gml_exclude_items"     ""
    "ows_include_items"     "all"
    "ows_exclude_items"     ""
  END
END

When I try a WMS getmap call I get this error message:

<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1">
<ServiceException>
msDrawMap(): Image handling error. Failed to draw layer named 'par_direct'.
msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `par_direct'.
'MSSQL:driver=FreeTDS;server=db-agribase-p.asurequality.com' does not contain the 'database' portion
</ServiceException>
</ServiceExceptionReport>

Any clues?

Many thanks,

Robert L. Sanson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20160510/6516a70e/attachment.html>


More information about the mapserver-users mailing list