Results 1 to 4 of 4

Thread: Import_Shape

  1. #1
    Join Date
    Mar 2011
    Posts
    3

    Unanswered: Import_Shape

    I have to table in database. One is base and another as referenced.
    When I import data to base table using import_shape then data loaded successfully but when another table which contains foreign key of base table data is not loading. If i remove foreign key constraints everything happen alright. Can somebody tell me that what is the problem occurring during import_shape command execution when we have referential integrity. In my database there is also spatial data.
    Here is the Script for import data

    !db2se_import_shape Master
    -fileName Constant_Layer\state.shp
    -srsName WGS_SRS_1003
    -tableSchema VER6_1
    -tableName State
    -spatialColumn Geometry
    -Client 1
    -CreateTableFlag 0
    -messageFile state.msg
    -exceptionFile exp.txt
    -commitScope 100
    ;

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I'm not sure I fully understand the scenario, but I can tell you for sure that import_shape is just executing regular INSERT statements under the covers. If you have referential integrity defined between your tables, you have to make sure that each record inserted into a dependent table has a corresponding record in the referenced/parent table. Otherwise, DB2 will reject the INSERT because of that. You may want to use a log file and have a look at the messages written there. This will show you what exactly the problem was.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Mar 2011
    Posts
    3

    Import_Shape

    Thanks for your reply stolze

    I have data for dependent table which have 30 records and the independent table have only one record. I refer independent table's Id as foreign key in dependent table.
    In message log the Error code is GSE0214N and the error description is "An insert statement failed="SQL0668N". Operation not allowed for reason code "7"on table "VER6_1.country" SQLSTATE-57016"
    Here VER6_1 is schema and country is independent table.I have state table as dependent table.
    the table structure is like this:
    1. Country -whose structure like [CNT_ID integer PK,CNT_Nme Character,geometry polygon]
    2. State-whose structure like[STT_ID Integer pk,CNT_ID Foreign Key,Stt_Nme char,Stt_alt Char,geometry polygon]

    I am waiting for your reply.

    Thanks
    Pavan Rai

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You may want to have a quick look at message SQL0668N: SQL0668N

    According to reason code 7, the table COUNTRY is in reorg-pending state due to some other operation you did before (maybe an ALTER TABLE ... ADD COLUMN ...). You should first reorganize the table and then retry the shape-import operation.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •