On 07/ 4/13 10:36 AM, Amit wrote:
This is the code I am using to execute query.Statement st = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); st.setFetchSize(100); ResultSet queryRs = st.executeQuery(sql); System.out.println("Success"); Usually the query takes 1-2 sec to execute. But very rare occasion the code got stuck at line 4.
That would be println... I assume you mean that it hangs in executeQuery()?
I have waited for 1 hr and then killed the thread. It's a production issue. I am using connection pool and my derby version is - 10.9.1.0 Can you help me narrow down the problem.
Really hard without more information. If you can post the SQL involved it would be helpful. Is this client/server or embedded? Is the table large? Do you access it through an index? Are other threads/connections accessing the same table simultaneously?
Anything in derby.log at the time of the hang? Regards, Dyre
