All the methods in DB.java now correctly use ConnectionException

I've also updated the documentation in DBInterface and added the
@throw ConnectionException clause where needed.
Fixed a bug in DB.java in some methods in case of empty cursors

All the methods that iterates over a cursor didn't check if the cursor
was empty before starting to iterate over it.