PDA

View Full Version : StoredProcedure - How to Set Timeout for StoredProcedure call



A Kumar
Apr 9th, 2012, 12:05 PM
Hi,

I have a class that extends StoredProcedure class of Spring API..for calling a Stored proc

How can i set a timeout for my stored proc call

setQueryTimeout in constructor is not working out..(i specified 1s as timout but it still gives me results after 2 seconds)

Regards

dr_pompeii
Apr 9th, 2012, 02:05 PM
Hello

Have you read the API for such class?
StoredProcedure (http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/jdbc/object/StoredProcedure.html)

Post your code (use code tags) to see what are you doing

A Kumar
Apr 20th, 2012, 04:44 AM
public MyStoredProcedure(DataSource dataSource, String storedProc) {

// Set the DataSource and the stored procedure name to be called.
super(dataSource, storedProc);
setQueryTimeout(1);

}