If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Import_Shape

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-11, 02:00
pavanrai pavanrai is offline
Registered User
 
Join Date: Mar 2011
Posts: 3
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

Quote:
!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
;
Reply With Quote
  #2 (permalink)  
Old 04-04-11, 02:49
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 04-04-11, 03:25
pavanrai pavanrai is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 04-04-11, 05:51
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
Reply

Tags
foreign, import_shape

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On