OGR Connection to MySQL

Frank Warmerdam warmerdam at POBOX.COM
Wed May 9 11:21:45 EDT 2007


Christian Braun wrote:
> Hey List,
> 
> I want to establish a connection between mapserver (pmapper client) and a
> MySQL-DB.
> It works fine with smaller queries like "select id,x,y from table". Actually
> i don't have a problem with such little things.
> If the queries getting more complex I get the results only in the Terminal
> window with ogrinfo.
> Such a query is
> "SELECT ALL
>        MG.MC_Name_col AS MCName,
>        M1.`AttribValueNum_col` AS x,
>        M2.`AttribValueNum_col` AS y
>   FROM MeasCampGlobal_tbl MG, MeasCampAttrib_tbl M1
>          LEFT OUTER JOIN IdRefStr_tbl I1
>            ON M1.AttribType_id=I1.id,
>        MeasCampAttrib_tbl M2
>          LEFT OUTER JOIN IdRefStr_tbl I2
>            ON M2.AttribType_id=I2.id
>   WHERE M1.MeasCampGlobal_tbl_id=MG.idMeasCampGlobal_tbl
>     AND M2.MeasCampGlobal_tbl_id=MG.idMeasCampGlobal_tbl
>     AND MC_WWTPRef_col = 'Bleesbrück'
>     AND I1.RefStr_col = 'Att_WWTP_CoordX'
>     AND I2.RefStr_col = 'Att_WWTP_CoordY'"
> As I said only results are displayed in the Terminal with the ogrinfo tool.
> Mapserver hangs up.
> 
> Any Ideas???
> 
> System is Ubuntu Edgy, Mapserver 4.10, GDAL 1.4

Christian,

No obvious reason comes to mind why this would fail.  I'd encourage you
to test with "shp2img" on your mapfile and turn on as much debugging
as you can, including setting the CPL_DEBUG environment variable to
ON to see GDAL/OGR debug output.

I suspect:
  1) some sort of quoting issue in the map file.
  2) a feature id problem interfering with queries.

But both are quite weak theories.

Debug output might give you some additional clues.

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