Can I set a JDBC timeout for a single query?
Use setQueryTimeout on the Statement (or PreparedStatement) object.
If you are using spring to manage transactions a time out can be specified at the transaction level as well. @Transactional(timeout=10)