How to time out long database query?

How to time out long database query?

Postby Rose » Wed Feb 13, 2013 1:22 am

Suppose we have very long database query in our business logic and user will not see the result on their request for some time. How to handle such situation in Servlet?
Rose
 
Posts: 20
Joined: Tue Jan 29, 2013 5:16 am

Re: How to time out long database query?

Postby Kishan » Mon Feb 18, 2013 7:08 am

You should be able to set time out value for Statement/PreparedStatement/CallableStatement using below method. This time out applicable for sql/query getting executed under that statement.

Code: Select all
statement.setQueryTimeout(5); //5 seconds
Kishan
 
Posts: 191
Joined: Tue Jan 29, 2013 4:21 am


Return to Servlets

Who is online

Users browsing this forum: No registered users and 1 guest

cron