If deadlocks occur frequently in your multi-user system with a particular application, you might need to do some debugging.
Derby provides the SYSCS_DIAG.LOCK_TABLE diagnostic table to help you debug deadlocks. This diagnostic table shows all of the locks that are currently held in the Derby database. You can reference the SYSCS_DIAG.LOCK_TABLE diagnostic table directly in a statement.
SELECT * FROM SYSCS_DIAG.LOCK_TABLE
When the SYSCS_DIAG.LOCK_TABLE diagnostic table is referenced in a statement, a snapshot of the lock table is taken.
For more information about how to use this table, see "SYSCS_DIAG.LOCK_TABLE diagnostic table" in the Derby Reference Manual.
You can also set the property derby.locks.deadlockTrace to dump additional information to the derby.log file about any deadlocks that occur on your system. See Derby Reference Manual for more information on this property. Also see "Monitoring deadlocks" in the Derby Server and Administration Guide.
Additional general information about diagnosing locking problems can be found in the Derby Wiki at http://wiki.apache.org/db-derby/LockDebugging.