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
2009-06-07 06:47:15
OK, Is this applicable to update query as well ?Where can I find more details about it.
Rig Veda
2009-06-08 06:49:00
http://en.wikipedia.org/wiki/Isolation_(database_systems)
cletus
2009-06-08 12:45:27
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
2009-06-07 14:22:19