In SpatiaLite or Postgis, how can one create a SQL query to read a table from a MySql or Oracle database?

I don't know **the correct SQL syntax to connect to a table in a MySql or Oracle database **.

  • One database product is not generally able to connect directly to another database. You would typically using an application (like QGIS or ArcGIS, for example) with support for multiple database backends and use this as the point of integration.
    – larsks
    Nov 25 '15 at 0:52
  • What exactly are you trying to do? Nov 25 '15 at 4:40
  • Hi @DevdattaTengshe, in QGis I'm trying with a SQL query to create a join between a spatial feature presents in my SpatiaLite db with a table from a MySQL db. I would like to create a live connection with the table presents in MySQL with an SQL query but I don't know the corret syntax to call remote database (host, database, port, user, password). Nov 25 '15 at 5:13

You may be able to do this in PostGIS by using Foreign Data Wrappers (FDW). There is one for Oracle and another that can wrap any OGR datasource (which should include MySQL).

I've never tried this (why would I store data outside PostGIS?) but this blog post suggests it is quite easy to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.