<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Steve,<br>
    <br>
      Here's a snippet from a MapServer map file I used to access a
    non-spatial MS SQL server via OGR+VRT+ODBC:<br>
    <br>
    <tt>    TYPE POINT<br>
          CONNECTIONTYPE OGR<br>
          CONNECTION "<OGRVRTDataSource><br>
              <OGRVRTLayer name='v_MyPoints'><br>
              <SrcDataSource>ODBC:username/password@WebMapDSN,</tt><tt>v_MyPoints</tt><tt></SrcDataSource><br>
                 <SrcSQL><br>
                  SELECT * FROM  </tt><tt>v_MyPoints</tt><tt> <br>
                  WHERE  PropertyID=%PropertyID%<br>
              </SrcSQL><br>
              <b><FID>PointID</FID></b><br>
              <GeometryType>wkbPoint</GeometryType><br>
              <GeometryField encoding='PointFromColumns'
      y='SurfaceLatitude'  x='SurfaceLongitude'/><br>
              <LayerSRS>NAD83</LayerSRS><br>
              </OGRVRTLayer><br>
          </OGRVRTDataSource>"<br>
      <br>
          PROCESSING "CLOSE_CONNECTION=DEFER"<br>
      <br>
          DATA "</tt><tt>v_MyPoints</tt><tt>"</tt><br>
    <br>
    In my case I was able to use the view's primary key as the FID. 
    Hope this helps...<br>
    <pre class="moz-signature" cols="72">Best Regards,
Brent Fraser</pre>
    <br>
    On 5/31/2012 7:48 AM, <a class="moz-txt-link-abbreviated" href="mailto:Steve.Toutant@inspq.qc.ca">Steve.Toutant@inspq.qc.ca</a> wrote:
    <blockquote
cite="mid:OFC5433BA4.6ED20415-ON85257A0F.004B8181-85257A0F.004BE607@isn.rtss.qc.ca"
      type="cite">
      <br>
      <font face="sans-serif" size="2">Thanks Jeff</font>
      <br>
      <font face="sans-serif" size="2">I got now OGR_ODBC: Table
        �s���s!.���������
        has no identified FID column.</font>
      <br>
      <br>
      <font face="sans-serif" size="2">I found that several users had
        this
        problem but found no solution. I don't have write access to this
        MSSQL
        server.</font>
      <br>
      <br>
      <font face="sans-serif" size="2">I'm connecting via ODBC to a non
        spatial
        table, but it contains latitude and longitude information. I
        will use it
        to define a </font><font face="Times New Roman" size="3">OGRVRTDataSource</font><font
        face="sans-serif" size="2">
        and create geometry from point.</font>
      <br>
      <br>
      <font face="sans-serif" size="2">Any clue on what I can do?</font>
      <br>
      <font face="sans-serif" size="2">thanks</font>
      <br>
      <font face="sans-serif" size="2">steve</font>
      <br>
      <font face="sans-serif" size="2"><br>
      </font>
      <p>
        <br>
        <br>
        <br>
        <table width="100%">
          <tbody>
            <tr valign="top">
              <td width="40%"><font face="sans-serif" size="1"><b>Jeff
                    McKenna
                    <a class="moz-txt-link-rfc2396E" href="mailto:jmckenna@gatewaygeomatics.com"><jmckenna@gatewaygeomatics.com></a>@lists.osgeo.org</b>
                </font>
                <br>
                <font face="sans-serif" size="1">Envoyé par :
                  <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev-bounces@lists.osgeo.org">gdal-dev-bounces@lists.osgeo.org</a></font>
                <p><font face="sans-serif" size="1">2012-05-30 17:06</font>
                </p>
              </td>
              <td width="59%">
                <table width="100%">
                  <tbody>
                    <tr valign="top">
                      <td>
                        <div align="right"><font face="sans-serif"
                            size="1">A</font></div>
                      </td>
                      <td><font face="sans-serif" size="1"><a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></font>
                      </td>
                    </tr>
                    <tr valign="top">
                      <td>
                        <div align="right"><font face="sans-serif"
                            size="1">cc</font></div>
                      </td>
                      <td>
                        <br>
                      </td>
                    </tr>
                    <tr valign="top">
                      <td>
                        <div align="right"><font face="sans-serif"
                            size="1">Objet</font></div>
                      </td>
                      <td><font face="sans-serif" size="1">Re:
                          [gdal-dev] ogr ODBC problem</font></td>
                    </tr>
                  </tbody>
                </table>
                <br>
                <table>
                  <tbody>
                    <tr valign="top">
                      <td>
                        <br>
                      </td>
                      <td><br>
                      </td>
                    </tr>
                  </tbody>
                </table>
                <br>
              </td>
            </tr>
          </tbody>
        </table>
        <br>
        <br>
        <br>
        <br>
        <br>
        <tt><font size="2">On 12-05-30 5:09 PM,
            <a class="moz-txt-link-abbreviated" href="mailto:Steve.Toutant@inspq.qc.ca">Steve.Toutant@inspq.qc.ca</a> wrote:<br>
            > <br>
            > Hi!<br>
            > I use this command to get the tables from an ODBC
            connection<br>
            > ogrinfo ODBC:User/Pwd@DNS<br>
            > <br>
            > The connection is succesful but I get this error
            several times<br>
            > ERROR 1: No column definitions found for table
            '�s���s!.�����������',<br>
            > layer not usable.<br>
            > <br>
            > I used OGR ODBC for several months from a Windows
            server to a MSSQL
            server<br>
            > Now I'm migrating to linux and accessing the same MSSQL
            SERVER and
            I get<br>
            > this error.<br>
            > <br>
            > Note that if I connect with isql, I can connect and
            query the database<br>
            > without problem.<br>
            > So the problem really seems to be with OGR<br>
            > <br>
            > What can cause this No column definitions found for
            table error<br>
            > And why the table name looks like this
             '�s���s!.�����������',<br>
            <br>
            Hi Steve,<br>
            <br>
            I was just debugging an ogrinfo command for MS4W/Oracle, and
            was<br>
            reminded of the trick to show more debug info at the
            commandline:<br>
            <br>
              set CPL_DEBUG=on<br>
            <br>
            I'm going to keep that one in my back pocket from now on.<br>
            <br>
            -jeff<br>
            <br>
            <br>
            <br>
            <br>
            -- <br>
            Jeff McKenna<br>
            MapServer Consulting and Training Services<br>
            <a class="moz-txt-link-freetext" href="http://www.gatewaygeomatics.com/">http://www.gatewaygeomatics.com/</a><br>
            <br>
            <br>
            _______________________________________________<br>
            gdal-dev mailing list<br>
            <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
            <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></font></tt>
        <br>
        <br>
        <br>
        <br>
      </p>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
  </body>
</html>