[Gdal-dev] ODBC can't connect using SQL statement

Eduardo Patto Kanegae epk.lists at gmail.com
Tue Nov 14 20:31:01 EST 2006


Hi,

I'm trying to access a point data table using MapServer through OGR VRT
driver but I'm having errors.

My data table is at SQL Server 2000 and I already created a system dns for
this database.

If I run:
$ ogrinfo ODBC:myuser/mypassword at MYDSN -sql "SELECT * FROM PointTable WHERE
themonth > 10"
this works fine

But when I try in MapServer:

    LAYER
        CONNECTION "<OGRVRTDataSource>
    <OGRVRTLayer name='pts'>
        <SrcDataSource>ODBC:myuser/mypassword at MYDSN</SrcDataSource>
        <SrcSQL>SELECT PointTable.* FROM PointTable WHERE themonth >
10</SrcSQL>
        <GeometryField encoding='PointFromColumns' x='Long' y='Lat'/>
        <GeometryType>wkbPoint</GeometryType>
    </OGRVRTLayer>
</OGRVRTDataSource>"
        CONNECTIONTYPE OGR
        DATA "pts"
        NAME "ptsodbc"
        STATUS DEFAULT
        TYPE POINT
        CLASS
            COLOR 255 0 0
            SIZE 6
            SYMBOL "sym_basic"
        END
    END

Then I got:
/* -----
msDrawMap(): Image handling error. Failed to draw layer named 'ptsodbc'.
msOGRFileNextShape(): OGR error. SetAttributeFilter() not supported on
ExecuteSQL() results.
msEvalContext: Expression parser error. Failed to parse context
msyyparse(): Expression parser error. syntax error
--- */

I only was able to filter data at this point table using FILTER and
FILTERITEM keywords at mapfile, but only using regular expressions . Logical
expressions does not show any point.

Is that something wrong at my connection string or is this a bug to be
solved using GDAL CVS ?

best,

-- 
Eduardo Patto Kanegae
http://www.webmapit.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061114/66f95a0e/attachment.html


More information about the Gdal-dev mailing list