Instructions provided describe the steps to convert a DB2 spatial table into a feature class to be used by ArcGIS.
- Create an empty table in DB2.
db2 => CREATE TABLE "MAP"."POLY"
("POLY_ID" BIGINT , "POLY_TYPE" INTEGER , "REASON_COD" INTEGER , "SOURCE_" INTEGER ,
"SOURCE_SUB" INTEGER , "QUAL" INTEGER , "ASSR_POLY_" BIGINT , "RCD_POLY_I" BIGINT ,
"TRNX_UID" VARCHAR(5) , "TRNX_DATE" DATE , "TRNX_PROG" VARCHAR(8) , "STOP_DATE" DATE ,
"SHAPE" "DB2GSE "."ST_MULTIPOLYGON" , "OBJECTID" INTEGER NOT NULL WITH DEFAULT 0 )
IN "SDEDB2" INDEX IN "SDEINDEX" LONG IN "SDELOBS"
- In the DB2 Control Center, register the spatial column for the empty table with DB2 Spatial Extender.
- At a command prompt, register the empty table with ArcSDE:
c:\>sdelayer -o register -l map.poly,shape -e a+
-C objectid,SDE -u map -p map -i 5920
- R <srid used to register the table with the Spatial Extender>
The -R option must be specified. If it is not, data cannot be loaded into the feature class.
- In ArcCatalog, connect to the geodatabase in which the 'poly' feature class was created. Right-click the 'poly' feature class and click Register with Geodatabase.
- Right-click the 'poly' feature class, click Load, then click Load Data. This launches the Simple Data Loader wizard. Follow the instructions in the Simple Data Loader wizard to load the features from the source.
- If the -R option was not specified in step 3 when the sdelayer command was issued, the following error is captured in the sde error log:
"DB_stream_execute_insert_table Execute Error (-51).
db_cli_execute_stmt: -545, 23513
db_cli_execute_stmt: [IBM][CLI Driver][DB2/NT] SQL0545N The requested operation is not allowed because a row does not satisfy the check constraint "MAP.POLY.DB2GSE312934858978". SQLSTATE=23513"
The table has to be unregistered then registered again before the data can be loaded.
- Use the sdelayer -o delete command to remove the feature class registration from ArcSDE.
c:>sdelayer -o delete -l map.poly,shape -u map -p map -i 5920
- Re-register the spatial table using the syntax in step 3.