Hi Ian,

2012/8/18 Ian Clarke <[email protected]>:
> I'm getting a lot of these in my code:
>
> org.jooq.exception.DataAccessException: SQL [null]; Deadlock found when
> trying to get lock; try restarting transaction
>     at org.jooq.impl.Util.translate(Util.java:496)
>     at
> org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:360)
>     at org.jooq.impl.BatchMultiple.execute(BatchMultiple.java:96)
>
> I'm using Jooq to talk to a MySql database, and the relevant statement is an
> .execute() call on a batch insert of up-to 500 rows.

Googling the error message, I find this to be a common issue with
MySQL databases. Here's some sample documentation about the InnoDB
engine and how it allows for "locking modes":
http://dev.mysql.com/doc/refman/5.6/en/innodb-lock-modes.html

Since this problem appears when inserting records, I'd suspect that
two concurrent processes try to acquire a table lock at the same time?
I couldn't find another explanation right now. Do you maybe have any
triggers on this table?

Unfortunately, I don't know MySQL well enough to help you here. Maybe
someone else on this group might have an idea? Otherwise, you might
have a better chance asking this question on Stack Overflow.

Reply via email to