<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none">I have a geodata source on SQLServer 2008 and have been using for a number of years the
<span style="font-size:9.5pt;font-family:Consolas">msplugin_mssql2008.dll plugin. I now want to use some stored procedures in my SQL server to render the geo data to MapServer. So I have been working with the OGR driver however I have found what I think is
 a problem when the SQL server is on a none standard TCP port as the comma in the server definition gets thrown away when rendering the layer using a map file via shp2img. I can use ogrinfo without problem but as soon as I carry the string to the OGR layer
 in the .map file and run shp2img –all_debug 1 I see that the tcp port of my SQL server is removed and hence the connection fails.
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">So the working OGR syntax is:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">ogrinfo "MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=MY_WEB-SqlServer.com,4670;tables=PointPlace_Waypoints(Position)" -summary<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">INFO: Open of `MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=MY_WEB-SqlServer.com,4670;tables=PointPlace_Waypoints(Position)'<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      using driver `MSSQLSpatial' successful.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">1: PointPlace_Waypoints<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal">NOTE: The TCP Port is 4670 – this is the same as used in the mssql2008.dll plug in.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When I use shp2img this is what I get:<o:p></o:p></p>
<p class="MsoNormal">shp2img -m latest.map -o test.png -all_debug 1<o:p></o:p></p>
<p class="MsoNormal">msDrawMap(): rendering using outputformat named png (AGG/PNG8).<o:p></o:p></p>
<p class="MsoNormal">msOGRFileOpen(MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas">MY_WEB-SqlServer.com,4670</span>)...<o:p></o:p></p>
<p class="MsoNormal">OGROPen(MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas"> MY_WEB-SqlServer.com</span>)<o:p></o:p></p>
<p class="MsoNormal">msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `latest1'.<o:p></o:p></p>
<p class="MsoNormal">Unable to initialize connection to the server for MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas">MY_WEB-SqlServer.com</span>,<o:p></o:p></p>
<p class="MsoNormal">[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">msDrawMap(): Image handling error. Failed to draw layer named 'latest1'.<o:p></o:p></p>
<p class="MsoNormal">msDrawMap(): Image handling error. Failed to draw layer named 'latest1'. <br><o:p></o:p></p>
<p class="MsoNormal">msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `latest1'.<o:p></o:p></p>
<p class="MsoNormal">Unable to initialize connection to the server for MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas">MY_WEB-SqlServer.com</span>,<o:p></o:p></p>
<p class="MsoNormal">[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You will notice that two lines:<o:p></o:p></p>
<p class="MsoNormal">msOGRFileOpen(MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas">MY_WEB-SqlServer.com,4670</span>)...<o:p></o:p></p>
<p class="MsoNormal">OGROPen(MSSQL:uid=xxx;pwd=xxx;database=xxx;Integrated Security=false;server=<span style="font-size:9.5pt;font-family:Consolas"> MY_WEB-SqlServer.com</span>)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The system is calling msOGRFileOpen with a ,4670 but the OGROPen has removed the comma and tcp port number hence my connection fails.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there a resolution to this or is there another way to execute stored procedures with MapServer layers?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">David<o:p></o:p></p>
</div>
</body>
</html>