On system crash or session ending error, Derby should dump as much information as possible. Such as: forcing a javacore if possible or at least thread dump and system environment information. This should only occur if a running session crashes not on boot error due to fail recovery etc.
The IBM jvm provides a way to programmatically dump a javacore. i.e. com.ibm.jvm.Dump.JavaDump() And, the SUN jvm will force a thread dump using the Unsafe class and there may be a better way.