db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Sundberg" <Mikael.Sundb...@artificial-solutions.com>
Subject RE: Foreign keys cuases deadlock?
Date Thu, 19 Feb 2009 13:31:48 GMT
Yes I belive that is the case.
The return code I get is the value of the "id" column of table1. This is
also the column that table2 has a foreign key to.
It fails before the Commit. More precise at the
prepearedStatement.executeUpdate for the second insert.

If im unclear I can write a testcase for it.

-----Original Message-----
From: Michael Segel [mailto:msegel@segel.com] On Behalf Of
Sent: den 19 februari 2009 14:21
To: 'Derby Discussion'
Subject: RE: Foreign keys cuases deadlock?

Let me see if I have this straight.

Auto commit is off.

You're trying the following pseudo code...

Begin transaction
  Insert into table 1
    Get some return code from the insert for your foreign key for table
  Insert into table 2
Commit Transaction

And this is failing?

> -----Original Message-----
> From: Mikael Sundberg
> Sent: Thursday, February 19, 2009 7:08 AM
> To: Derby Discussion
> Subject: Foreign keys cuases deadlock?
> Hi I have the following problem.
> Im using autocommit off.
> I start by inserting into table1.
> I then want to insert into table2 that has a foreign key to table 1.
> use generatedkeys from my insert)
> This fails since it cant obtaing a lock on table1
> Is that expected?
> If I add a commit between the two statements it works.
> /Micke

View raw message