[gdal-dev] Issue with ogrinfo: unixODBC and MS SQL

Gregor at HostGIS gregor at hostgis.com
Mon Mar 22 18:16:30 EDT 2010


Hey guys. A few weeks back, Chaitanya helped us out with some fixes 
regarding unixODBC on 64-bit platforms, and got MapServer able to render 
remote data via ODBC from PostgreSQL and MySQL. Thanks a million!

Now we're on the last step: getting OGR data sources to work when the 
ODBC server is Microsoft SQL Server. Unlike MySQL and PgSQL, though, MS 
SQL returns some weird binary stuff:

$ ogrinfo test.ovf
ERROR 1: No column definitions found for table 
'�o��y.����y', layer not usable.
ERROR 1: No column definitions found for table 
'���������.��������S', layer not usable.
ERROR 1: No column definitions found for table 
'���������.���������EA', layer not 
usable.
(... and so on ...)


PHP and MS SQL and ODBC get along just fine as long as I set my ODBCINI 
and FREETDSCONF files, and make sure to use a DSN instead of a DSN-less 
connection string. I can use the isql program and connect too. So the 
basic unixODBC and MS SQL layers seem to be working okay.

Any ideas?

The OVF is as follows:

<OGRVRTDataSource>
     <OGRVRTLayer name="dsn">
         <SrcDataSource>ODBC:user/pass at dsn</SrcDataSource>
         <SrcLayer>cities</SrcLayer>
         <GeometryType>wkbPoint</GeometryType>
         <LayerSRS>WGS84</LayerSRS>
         <GeometryField encoding="PointFromColumns" x="x" y="y"/>
     </OGRVRTLayer>
</OGRVRTDataSource>


The odbc.ini is:

[dsn]
Driver  = Microsoft SQL Server
Server  = ec2-A-B-C-D.compute-1.amazonaws.com
Port    = 1433
Database = testing
TDS_Version = 7.0

The freetds.conf is:

[global]
tds version = 7.0
text size = 64512
[dsn]
host = ec2-A-B-C-D.compute-1.amazonaws.com
port = 1433


-- 
HostGIS, Open Source solutions for the global GIS community
Greg Allensworth - SysAdmin, Programmer, GIS Person, Security
    Network+   Server+   A+   Security+   Linux+
    PHP   PostgreSQL   MySQL   DHTML/JavaScript/AJAX

"No one cares if you can back up — only if you can recover."


More information about the gdal-dev mailing list