tags:

views:

183

answers:

2

Is there any condition under which PreparedStatement.executeQuery() does not return ro throw an exception ?

+3  A: 

It depends on the database you're using and the configured isolation level. A common default is that a SELECT will block if you're trying to select records that have been updated in another transaction that hasn't committed yet.

Are you trying to select uncommitted data? What database are you using?

Alternatively your query may just be taking a really long time. Eliminate (or confirm) this possibility by running the query through some database tool.

You may also want to call setQueryTimeout() so the query won't block "forever".

cletus
OK, Is this applicable to update query as well ?Where can I find more details about it.
Rig Veda
http://en.wikipedia.org/wiki/Isolation_(database_systems)
cletus
A: 

If it hasn't returned, then it's still running your query, or is still fetching the results.

Try running the query outside of java, using a database tool of some sort, and make sure it's executing in a timely fashion.

skaffman