The attached program TryTimeout.java should detect a deadlock but instead throws a lock timeout exception. The program has two threads that attempt:
/* set isolation level to repeatable read */
ResultSet rs = stmt.executeQuery("select * from t where i = 456");
stmt.executeUpdate("update t set i = 456 where i = 456");
This gives SQLState 40001 (deadlock) with DB2 but a lock timeout with Derby.