Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for an example how to load a shapefile from the file system into an oracle spatial database.

What I have so far is:

  • I load the shapefile with the 'Shapefile File input' step
  • I use the calculator step to transform the WKT from the shapefile into a Geometry
  • I use the Table output to write the data into the database.

I get an error from the Table output step which says 'Error setting value #6 [GEOM Geometry] on prepared statement (Geometry), java.sql.SQLException: invalid datatype

The target column is of type SDO_GEOMETRY.

Thanks D3

share|improve this question

Although this example does not have geokettle I'm working backward from oracle spatial and perhaps the document has relevant information.

D Loading ESRI Shapefiles into Spatial

The Java Shapefile converter transforms an ESRI Shapefile into an Oracle Database table for use with Oracle Spatial and Locator. The Shapefile converter uses the Oracle Spatial Java-based Shapefile AdapterShapefileJGeom and SampleShapefileToJGeomFeature classes to load a Shapefile directly into a database table, with the Oracle-equivalent .dbf data types for the attribute columns and the SDO_GEOMETRY data type for the geometry column.

To load a Shapefile into the database, use the converter as described in this appendix. (You can also use the Adapter class to create your own applications and interfaces that transform Shapefiles to SDO_GEOMETRY or JGeometry data types; however, doing this is beyond the scope of this manual. For information about Shapefile-related classes, see Oracle Spatial Java API Reference).

To use the Shapefile converter, you must have the following:

The following Oracle utilities and JDBC libraries: ojdbc14.jar or ojdbc5.jar, sdoutl.jar, and sdoapi.jar

One or more ESRI Shapefiles (.shp, .shx, .and .dbf files) to be converted

D.1 Usage of the Shapefile Converter

The following is the syntax for the Shapefile converter. (Enter the command all on a single line.)

java -cp [ORACLE_HOME]/jdbc/lib/ojdbc5.jar:[ORACLE_HOME]/md/jlib/sdoutl.jar:[ORACLE_HOME]/md/jlib/sdoapi.jar oracle.spatial.util.SampleShapefileToJGeomFeature -h db_host -p db_port -s db_sid -u db_username -d db_password -t db_table -f shapefile_name [-i table_id_column_name][-r srid][-g db_geometry_column][-x max_x,min_x][-y max_y,min_y][-o tolerance] Parameters

-h: Host machine with an existing Oracle database

-p: Port on the host machine (for example, 1521)

-s: SID (database name) on the host machine

-u: Database user

-d: Password for the database use

-t: Table name for the converted Shapefile

-f: File name of an input Shapefile (without extension)

-i: Column name for unique numeric ID, if required

-r: Valid Oracle SRID for coordinate system; use 0 if unknown

-g: Preferred SDO_GEOMETRY column name

-x: Bounds for the X dimension; use -180,180 if unknown

-y: Bounds for the Y dimension; use -90,90 if unknown

-o: Load tolerance fields (x and y) in metadata; if not specified, tolerance fields are 0.05

-a: Append Shapefile data to an existing table

-n: Start ID for column specified in -i parameter

-c: Commit interval; by default, commits occur every 1000 conversions and at the end

-v: Println interval; by default, a display every 10 conversions

D.2 Examples of the Shapefile Converter

The following examples show the use of the Shapefile converter to transform a file named shapes to a table named shapes containing an SDO_GEOMETRY column named geom. The SRID for the Longitude/Latitude (WGS 84) coordinate system is used (8307).

Linux Example

setenv clpath $ORACLE_HOME/jdbc/lib/ojdbc5.jar:$ORACLE_HOME/md/jlib/sdoutl.jar:$ORACLE_HOME/md/jlib/sdoapi.jar java -cp $clpath oracle.spatial.util.SampleShapefileToJGeomFeature -h gis01 -p 1521 -s orcl -u scott -d -t states -f states -r 8307 -g geom Windows Example

java -classpath %ORACLE_HOME%\jdbc\lib\ojdbc5.jar;%ORACLE_HOME%\md\jlib\sdoutl.jar;%ORACLE_HOME%\md\jlib\sdoapi.jar oracle.spatial.util.SampleShapefileToJGeomFeature -h gis01 -p 1521 -s orcl -u scott -d -t states -f states -r 8307 -g geom

share|improve this answer
The link is:… – lewis May 31 '13 at 0:15
thanks for the good info, but I am really looking for a solution with geokettle – I. Gona May 31 '13 at 8:29
up vote 1 down vote accepted

To load a shapefile into an oracle database just a 'Shapefile input' and an 'Table output' is required, Geokettle handles everything internally

In the shapefile input You define the shapefile and in the output You map the geometry of the shape file (GeoKettle identifies the geometry for You) to the corresponding db-column.

To see an example You may copy the following XML and paste it into the graphical area of a transformation.

<?xml version="1.0" encoding="UTF-8"?>
    <name>Shapefile File Input</name>
    <filename>D:\GIS\data\Admin Deutschland\DEU_adm3.shp</filename>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>

    <name>Table output</name>
    <connection>local oracle</connection>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>

  <hop> <from>Shapefile File Input</from><to>Table output</to><enabled>Y</enabled> </hop>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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