Subject Re: [firebird-support] Violation Foreign Key
Author Helen Borrie
At 06:56 PM 12/05/2006, you wrote:
>Hello,
>Foreign key violation occurs but shouldn't.
>I have 2 tables : MVT and CONT_GEST.
>I only insert and update on MVT (no delete), it has a foreign key on
>CONT_GEST.
>The table CONT_GEST has only 2 records, and the foreign key is always
>on the same record.
>a foreign key violation occurs randomly and often, and fields (on
>foreign key) are well formed.
>
>Note :
>Firebird 1.5.3
>Jaybird
>Multi-user context
>2 fields compose the foreign key
>I have 2 program in use : a program jar and a tomcat program.
>Tomcat 4.1.31 on jdk 1.4.2-08
>
>my error :
>org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544345. lock
>conflict on no wait transaction
>violation of FOREIGN KEY constraint "MVT_CONT_PHYS_CONT_GEST_EXIST"
>on table "LG_MVT_CONT_PHYS"
>at
>org.firebirdsql.jdbc.AbstractPreparedStatement.internalExecute
>(AbstractPreparedStatement.java:483)
>at
>org.firebirdsql.jdbc.AbstractPreparedStatement.executeUpdate
>(AbstractPreparedStatement.java:144)

You have to COMMIT the master row in the first transaction; and the
second transaction must be able to see that committed row in order to
post valid child records that refer to its primary key.

For advice about what Jaybird is doing in each transaction, you are
in the wrong list - you need to subscribe to firebird-java.

./heLen