473,769 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I-Series DB2 Self-referential constraint issue causing locks

I was having an issue inserting data into a table in an I-Series DB2
database. The Insert statement itself is very simple:

Insert into Table1
select * from Table2

These two tables have identical structures.

What happens is that the process gets locked and one cannot kill it
regardless of what one does. The only solution seems to be to IPL the
machine.

The above Insert works fine for all the other tables. What is special
about this table layout is that it has two self-referential
constraints. The "bulk" select/insert contains records that would
reference each other after they were all inserted.

Here is a simplified layout:

CREATE TABLE testtable
(
personId DEC(9,0) NOT NULL,

.... various fields ...

fatherId DEC(9,0) NOT NULL,
motherId DEC(9,0) NOT NULL,
CONSTRAINT pk001 PRIMARY KEY (personId)
)
;

CREATE UNIQUE INDEX idx001 ON testtable (personId ASC)
;
ALTER TABLE testtable ADD CONSTRAINT fk001 FOREIGN KEY (
fatherId
)
REFERENCES testtable (
personId
)
;

ALTER TABLE testtable ADD CONSTRAINT fk002 FOREIGN KEY (
motherId
)
REFERENCES testtable (
personId
)
;

As things stand, I cannot change the layout.
Since the "bulk" select/insert does not work, I have changed to a
"programmat ic" record-at-a-time approach. (I guess I could also
unload/load). But, I'm curious is anyone has encountered this issue.

I would think that even if the data is bad or the data cannot be
handled, it ought to end with some kind of SQL error rather than
locking up and "hanging".
Has anyone encountered and/or solved this issue?

Nov 12 '05 #1
1 3098
I'm not sure what is happening but I offer the following thoughts:

1. If table2 is not updated because it is populated from table1; drop
the relational constraint on table 2.
2. Try loading without the relational constraint then altering the table
to add it.
3. check if the "NOT ENFORCED" clause of a constraint definition can be
used to allow loading and then reactivate the constraint.

None of there addresses the underlying question but they may provide a
workaround.

Philip Sherman

Darius wrote:
I was having an issue inserting data into a table in an I-Series DB2
database. The Insert statement itself is very simple:

Insert into Table1
select * from Table2

These two tables have identical structures.

What happens is that the process gets locked and one cannot kill it
regardless of what one does. The only solution seems to be to IPL the
machine.

The above Insert works fine for all the other tables. What is special
about this table layout is that it has two self-referential
constraints. The "bulk" select/insert contains records that would
reference each other after they were all inserted.

Here is a simplified layout:

CREATE TABLE testtable
(
personId DEC(9,0) NOT NULL,

... various fields ...

fatherId DEC(9,0) NOT NULL,
motherId DEC(9,0) NOT NULL,
CONSTRAINT pk001 PRIMARY KEY (personId)
)
;

CREATE UNIQUE INDEX idx001 ON testtable (personId ASC)
;
ALTER TABLE testtable ADD CONSTRAINT fk001 FOREIGN KEY (
fatherId
)
REFERENCES testtable (
personId
)
;

ALTER TABLE testtable ADD CONSTRAINT fk002 FOREIGN KEY (
motherId
)
REFERENCES testtable (
personId
)
;

As things stand, I cannot change the layout.
Since the "bulk" select/insert does not work, I have changed to a
"programmat ic" record-at-a-time approach. (I guess I could also
unload/load). But, I'm curious is anyone has encountered this issue.

I would think that even if the data is bad or the data cannot be
handled, it ought to end with some kind of SQL error rather than
locking up and "hanging".
Has anyone encountered and/or solved this issue?


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1868
by: Whitney | last post by:
On the left side of the main webpage I have some menu options that have a drop-down feature that is controlled with javascript. You click on the main heading and the links for that section show up. Click on it again and they disappear. This works great in IE6 but doesn't seem to work in Netscape 7. I have included the main javascript code below, along with a sample of the Menu code. What (if anything) do I need to tweak to get this to...
7
5625
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT statements using the same iDB2Connection and iDB2Command. Then I want to Commit() so that either all the data goes in, or not. What happens though is this:
2
6232
by: Mike | last post by:
Hellos again, I seem to be having a weird issue. Whenever DB2 Health monitor seems to run, all connections to the database seem to just lock up. For example: (and this seems consistent) In list applications, DB2Hmon will show as "compiling statement", If I issue a "connect to database"it will hang there until DB2HMON is completed and no longer showing as a active application. Below is a lock snapshot that occurs when this is happening....
17
7180
by: Sulu's Beard | last post by:
Hey gang, I'm evaluating the CA ERWin product for an upcoming data warehousing project. I'm most excited about the reverse engineering aspect of this system. I've sucessfully tested it on a SQL Server 2000 system, however, when I run it against our iSeries DB2 system (on which our ERP exists), I encounter errors that essentially say that files are missing from our SYSCAT library. I'm not an iSeries expert, but I can say that the
0
1642
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT statements using the same iDB2Connection and iDB2Command. Then I want to Commit() so that either all the data goes in, or not. What happens though is this:
2
2824
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We intermittantly get the following exception - EXCEPTION MESSAGE: The viewstate is invalid for this page and might be corrupted. STACK TRACE:
10
4301
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the application looks for existing rows in the table...if they already exist then it updates otherwise inserts them. The table is pretty large, around 6.5 million rows.
2
2273
by: Ben.Combrink | last post by:
Hi I'm using DB2 V9.1.0 on SUSE Linux with kernel version 2.6.5. In the system I'm working on, there are several stored procedures which perform simple selects through different views. Those views are redefined (drop/create) periodically. DB2 rebinds the stored procedures that use the views, automatically.
0
27258
by: maheshmohta | last post by:
Background Often while remodeling legacy application, one of the important tasks for the architects is to have an optimum usage of storage capabilities of database. Most of the legacy applications are constrained by the technology available at the time of their development and hence aren’t optimum as per current scenario. One of such cases is the extensive usage of CHAR fields, which aren’t optimum solution for space storage now. This paper...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.