Rig Veda Rig Veda - 8 days ago 7
Java Question

executeQuery() not returning

Is there any condition under which the following statement

PreparedStatement.executeQuery()


does not return or throw an exception?

Answer

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".

Comments