MySQL Forums
Forum List  »  Connector/JDBC and Java

foreign key error, but only in jdbc.
Posted by: carl christianson
Date: May 18, 2012 09:50PM

Wasn't sure if I should post there here or over under stored procedures.
but since the error only occurs in jdbc here we go...

I have 2 tables. both InnoDB.
They one is a child of the other.

The parent table has an auto_increment INT primary key.

The stored procedure takes the parameters in,
it does an insert, on duplicate key update on the parent.
then gleans the info necessary to do the same insert/update on the child table.

All works fine in sql workbench.
All works fine in java calling it as a single threaded app (one connection to db).

However, as soon as a pool of connections are involved calling this same java code that works as an app, gets this error.
"Cannot add or update a child row: a foreign key constraint fails..."
The procedure handles the parent and child all in the same code, so not sure how this can work in one place and not another.

This is 5.5.23.

Any thoughts?

Options: ReplyQuote

Written By
foreign key error, but only in jdbc.
May 18, 2012 09:50PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.