I have an oracle table which I would like to query/make a selection. I would then like to export the selection to a shp file.
I'm using gdal and ogr2ogr.
Following the guidelines here and here I have come up with the following:
ogr2ogr -f "ESRI Shapefile" c:/Testing/Scratch/GDAL/symbol.shp OCI:dbusername/db_password@tns_name -sql "SELECT* FROM tablename where VERSION_DATE >= CURRENT_DATE -8" -progress
I then get the following error: "Unable to open datasource 'OCI:dbusername/db_password@tns_name' with the following drivers"
There is then a long list of drivers including "ESRI Shapefile".
I have now added " after OCI as suggested.
ogr2ogr -f "ESRI Shapefile" c:/Testing/Scratch/GDAL/symbol.shp OCI:"dbusername/db_password@tns_name -sql "SELECT* FROM tablename where VERSION_DATE >= CURRENT_DATE -8" -progress
I no longer get the errors about it being unable to open the datasource with the drivers. I now just get an "Access in denied".
I have a working connection to the database in ArcGIS using the same username & password. Does gdal generate its own user?
Answer
No, gdal doesn't generate any user.
You should find '-> "OCI" (read/write)' in the Supported Formats list if "OCI driver" is installed/configured properly. At this point the following syntax (you have to customize a little bit) should work:
ogr2ogr -f "ESRI Shapefile" /favourite/path/test.shp OCI:"/@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = )))(CONNECT_DATA = (SID =))):."
No comments:
Post a Comment