OGR connection for LINUX

joÿffffffffffe3o Antunes bluetuna_goes_skying at YAHOO.CO.UK
Mon May 23 04:51:24 PDT 2005


Hello frank,

I am still fighting to have mysql support using OGR..

the "funny" thing is that each time I run

ogrinfo -ro -al -so
'MYSQL:database=abruzzo,tablename=zzz,user=arit,password=arit,host=localhost,port:3306'

I get this message:

Warning 1: 'tablename=zzz' in MYSQL datasource
definition not recognised and ignored.
Warning 1: 'port:3306' in MYSQL datasource definition
not recognised and ignored.
ERROR 1: MySQL connect failed for:
database=abruzzo,tablename=zzz,user=arit,password=arit,host=localhost,port:3306
Unknown database 'database=abruzzo'
FAILURE:
Unable to open datasource
`MYSQL:database=abruzzo,tablename=zzz,user=arit,password=arit,host=localhost,port:3306'
with the following drivers.
  -> ESRI Shapefile
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> MapInfo File
  -> DGN
  -> VRT
  -> AVCBin
  -> REC
  -> Memory
  -> CSV
  -> GML
  -> MySQL

And all the database, table, user... exist.

Also if I try

ogrinfo --formats

I get:

Loaded OGR Format Drivers:
  -> "ESRI Shapefile" (read/write)
  -> "UK .NTF" (readonly)
  -> "SDTS" (readonly)
  -> "TIGER" (read/write)
  -> "S57" (read/write)
  -> "MapInfo File" (read/write)
  -> "DGN" (read/write)
  -> "VRT" (readonly)
  -> "AVCBin" (readonly)
  -> "REC" (readonly)
  -> "Memory" (read/write)
  -> "CSV" (read/write)
  -> "GML" (read/write)
  -> "MySQL" (readonly)

witch would make me think that the driver for mysql is
working..

So far I have:

1 configured GDAL --with-ogr --with-mysql
2 make (GDAL)
3 make install (GDAL)
4 Configured mapserver --with-OGR --with-php
5 Make (mapserver)

could you please give a clue on could be wrong?

Thank you again..

Best regards,

joao


--- Frank Warmerdam <fwarmerdam at GMAIL.COM> wrote:
> On 5/5/05, joÿffffffffffe3o Antunes
> <bluetuna_goes_skying at yahoo.co.uk> wrote:
> > Thank you Frank for your kind help.
> >
> > I still have some issues though..
> >
> > I don't understand which syntax I should use.. I
> am trying something like
> >
> >
> >    CONNECTIONTYPE OGR
> >    CONNECTION "C:\Programmi\Apache
> >
>
Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"
> >    DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN
> > 'MYGIS:database=zzzz_abruzzo, tablename=zzz,
> user=rt, password=rt,
> > port=3306' ON comuni_abruzzo_gb.Id = zzz.ID"
>
>
> Joao,
>
> Yikes, I completely missed the join in your select.
> First, is your
> OGR built with MySQL support?  This isn't all that
> common.
>
> Second, the direct MySQL support is done using:
>
>
>
MYSQL:database=zzzz_abruzzo,tablename=zzz,user=rt,password=rt,port=3306
>
> (not MYGIS).  Also, I suggest removing the space.
> Phase 1 of constructing
> such a query would be to try accessing the MySQL
> database externally
> with the ogrinfo commandline program.
>
> eg.
>
> ogrinfo -ro -al -so
>
'MYSQL:database=zzzz_abruzzo,tablename=zzz,user=rt,password=rt,port=3306'
>
> If you don't get a list of tables doing this, then
> you are likely lacking the
> driver.  You can check for the driver using "ogrinfo
> --formats".
>
> Next, try your full query with ogrinfo and see if it
> works.
>
> eg.
>
> ogrinfo -ro
>
"C:\Programmi\Apache\Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"
>  -sql  "SELECT * FROM comuni_abruzzo_gb LEFT JOIN
> MYSQL:database=zzzz_abruzzo, tablename=zzz, user=rt,
> password=rt,
> port=3306' ON comuni_abruzzo_gb.Id = zzz.ID"
>
> If that works, then transfer the query back into
> your map.
>
> PS. I just read the driver help for the MySQL OGR
> driver, and I see it said to
> prefix the datasource name with MYGIS (instead of
> MYSQL).  Sorry about that,
> it was an error.  I have corrected it now.
>
> 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    | Geospatial
> Programmer for Rent
>



___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com



More information about the MapServer-users mailing list