SQLServer 2005 via ovf

Frank Warmerdam warmerdam at POBOX.COM
Thu Jul 26 12:51:53 EDT 2007


Josh Hevenor wrote:
> I’m trying to connect to a SQLServer 2005 table through OVF with little 
> success…
> 
>  
> 
> My OVF file
> 
>  
> 
>             <OGRVRTDataSource>
> 
>     <OGRVRTLayer name="banner_location">
> 
>         <SrcDataSource>ODBC:usr/pwd at ourdb,table_name</SrcDataSource>
> 
>                   <SRCLayer>table_name</SRCLayer>
> 
>                               <GeometryType>wkbPoint</GeometryType>
> 
>                               <GeometryField encoding="PointFromColumns" 
> x="LONGITUDE" y="LATITUDE"/>
> 
>     </OGRVRTLayer>
> 
> </OGRVRTDataSource>
> 
>  
> 
> Our mapfile just has a background (province) polygon layer and this 
> point layer. When I use shp2img there is no error reported but my points 
> aren’t on the image.
> 
>  
> 
>             shp2img -m geoportal.map -o testing.png
> 
> msDrawMap(): Layer 0 (Province), 0.172s
> 
> msDrawMap(): Layer 1 (Major Roads), 0.046s
> 
> msDrawMap(): Layer 2 (our_layer), 7.157s         // the ovf layer
> 
> msDrawMap(): Drawing Label Cache, 0.000s
> 
> msDrawMap() total time: 7.375s 
> 
>  
> 
> I can use mapserv.exe to draw a map when the ovf layer is turned off. 
> When I attempt to connect through mapserver (mapscript, php) I get the 
> following error
> 
>  
> 
>             [MapServer Error]: msOGRFileOpen(): Open failed for OGR 
> connection `..\..\common\data\ovf\our_layer.ovf'.
> 
> Unable to initialize ODBC connection to DSN for usr/pwd at ourdb,table_name,
> 
> [Microsoft][SQL Native Client]Named Pipes Provider: Could not open a 
> connection to SQL Server [1326].
> 
>  
> 
> When I use the ‘Sql Server’ odbc driver in the connection I get the 
> following for line 3 instead of the Named Pipes stuff
> 
>  
> 
>             [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does 
> not exist or access denied.

Josh,

This seems like permissions problems.  I don't quite "get" the permissions
model under windows, but I'd suggest:

  1) make sure your DSN is a system dsn, not a user dsn.
  2) Investigate what you need to do to let your web user have
     permission to use the DSN.

BTW, 7 seconds to render the points layer with shp2img is pretty
terrible.  Are you sure you want this to work?  There are some
mechanisms to have the spatial query passed down to SQL Server to
be evaluated against the table.  This might improve performance
substantially.  Contact me off list if you can't find enough info
in the OVF howto on mapserver.gis.umn.edu or in the OGR VRT driver
docs.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list