I got a org.apache.derby.client.am.DisconnectException when using Derby 10.1
I just did something like

"select access_time, application, keyword, user_ip from log_request where access_time between timestamp('2007-10-01', '00:00:00') and timestamp('2007-10-28', '23:57:30')"

and got the disconnection.

The error message is like:
ERROR (no SQLState): A communication error has been detected. Communication protocol being used: Reply.fill(). Communication API being used: InputStream.read(). Location where the error was detected: insufficient data. Communication function detecting the error: *. Protocol specific error codes(s) TCP/IP SOCKETS

The returned rows should be above 7966 rows. If I try to restrict the constraints so that the return rows is below 7966 rows that is OK.
Any ideas about this?