Phil,<div><br></div><div>You should not specify the data section in the OGR layer definition unless you would define and sql select statement preceding with the &#39;where&#39; keyword. The terms &#39;using unique&#39; and &#39;using srid&#39; are not meaningful for the ogr driver these parameters are automatically retrieved from the geometry_columns metadata table. You should however specify the table name (and probably the geometry column name) in the connection string, something like:</div>
<div><br></div><div> CONNECTION &#39;
MSSQL:server=xxx;database=;uid=xxx;pwd=xxx;tables=NAV_STATE&#39;</div><div><br></div><div>or</div><div><br></div><div> CONNECTION &#39; MSSQL:server=xxx;database=;uid=xxx;pwd=xxx;tables=NAV_STATE(ShapeGeometry)&#39;</div>
<div><br></div><div><br></div><div>The difference in performance may be investigated by reading large number of shapes at a given scale. </div><div>I&#39;m also planning to improve the mapserver mssql plugin to read native SqlGeometries, but I&#39;m now working on a QGIS mssql driver right now.</div>
<div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div><br></div><div> <br><br><div class="gmail_quote">2012/2/26 Anzel, Phil - NRCS, Fort Collins, CO <span dir="ltr">&lt;<a href="mailto:Phil.Anzel@ftc.usda.gov">Phil.Anzel@ftc.usda.gov</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">All,<br>
<br>
I&#39;m a bit confused: does MapServer 6.0.1 and OGR &quot;officially&quot; work with Sql Server 2008? I can see how use of the native SqlGeometry objects might be a bonus and would like to put it to the test.<br>
<br>
MSSQL access via the plugin works with this LAYER:<br>
  LAYER<br>
    NAME &#39;States&#39;  STATUS ON<br>
    PROJECTION &#39;proj=latlong&#39; &#39;ellps=GRS80&#39; &#39;datum=NAD83&#39; END<br>
    CONNECTIONTYPE PLUGIN<br>
    PLUGIN ...\msplugin_mssql2008.dll&#39;<br>
    CONNECTION &#39;server=xxx;database=;uid=xxx;pwd=xxx&#39;<br>
    PROCESSING &#39;CLOSE_CONNECTION=DEFER&#39;<br>
    DATA &quot;ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269&quot;<br>
    TYPE POLYGON<br>
    CLASS STYLE OUTLINECOLOR &#39;#e1dd00&#39; WIDTH 2 END END<br>
  END<br>
<br>
This variant, changed to use OGR, fails:<br>
  LAYER<br>
    NAME &#39;States&#39;  STATUS ON<br>
    PROJECTION &#39;proj=latlong&#39; &#39;ellps=GRS80&#39; &#39;datum=NAD83&#39; END<br>
    CONNECTIONTYPE OGR<br>
    CONNECTION &#39;MSSQL:server=xxx;database=;uid=xxx;pwd=xxx&#39;<br>
    PROCESSING &#39;CLOSE_CONNECTION=DEFER&#39;<br>
    DATA &quot;ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269&quot;<br>
    TYPE POLYGON<br>
    CLASS STYLE OUTLINECOLOR &#39;#e1dd00&#39; WIDTH 2 END END<br>
  END<br>
<br>
Using shp2img (from MapServer 6.0.1 distribution for Win32/VS2010 retrieved 2011-07-18) with &quot;-all_debug 5&quot; yields:<br>
  msOGRFileOpen(): OGR error.<br>
  GetLayer(ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269)<br>
  failed for OGR connection `MSSQL:server=xxx;database=xxx;uid=xxx;pwd=xxx&#39;.<br>
There is no further detail as to the failure.<br>
<br>
By way of reference,<br>
1. In mapserver-users Digest, Vol 49, Issue 58, Tamas Szekeres states &quot;BTW: With the current approach, connecting to mssql via OGR provides better performance than using the mssql plugin.&quot;<br>
2. Tamas also indicates that OGR can talk to MSSQL in &quot;[gdal-dev] OGR MS SQL Spatial driver has been added&quot;, <a href="http://www.osgeo.org/pipermail/gdal-dev/2010-September/026055.html" target="_blank">http://www.osgeo.org/pipermail/gdal-dev/2010-September/026055.html</a>.<br>

3. MapServer documentation at <a href="http://mapserver.org/input/vector/ogr.html" target="_blank">http://mapserver.org/input/vector/ogr.html</a> does not list MSSQL as a data provider.<br>
4. MapServer documentation at <a href="http://mapserver.org/input/vector/mssql.html" target="_blank">http://mapserver.org/input/vector/mssql.html</a> still shows use of the msplugin_mssql2008.dll plugin.<br>
<br>
I must also wonder: has a measurable improvement been demonstrated by eliminating the plugin and going to the direct OGR to MSSQL connection?<br>
<br>
Yours in confusion,<br>
<br>
- Phil Anzel<br>
       Contractor for USDA/NRCS<br>
       ITC Web Soil Survey Team Member<br>
<br>
This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.<br>

<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</blockquote></div><br></div>