aspose file tools*
The moose likes JDBC and the fly likes Detecting inifite looping of Stored proc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Detecting inifite looping of Stored proc" Watch "Detecting inifite looping of Stored proc" New topic
Author

Detecting inifite looping of Stored proc

Babji Reddy
Ranch Hand

Joined: Jan 24, 2006
Posts: 106
Hello there,
I use a callable statement that executes a Stored Procedure (Oracle), due to some logical bug, this stored proc is not returning (but just looping infinitely).
How do I control this time-out?
I am not using a fixed connection created from DriverManager (instead of obtaining one from conn pool, due to architectual issues).
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Um, wouldn't it be easier to just fix the bug? Why do you want to work around it?


Ping & DNS - updated with new look and Ping home screen widget
Babji Reddy
Ranch Hand

Joined: Jan 24, 2006
Posts: 106
Well, I do want the pl/sql developer to fix the bug.
But lets say its not an infinite loop, but it takes an hour. Should my JDBC call just hang on to it helpless.
In such case, wouldn't some JVM Thread monitor thinks its a hung thread and kill it?
So I am wondering if I can handle this at Java layer.
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
The interface java.sql.Statement defines the method

public void setQueryTimeout(int seconds) throws SQLException

Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds. If the limit is exceeded, an SQLException is thrown.

JavaDoc
Babji Reddy
Ranch Hand

Joined: Jan 24, 2006
Posts: 106
That worked perfectly for me. Thanks much!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Detecting inifite looping of Stored proc
 
Similar Threads
Query on arraylist
Sorting Strings in Oracle
Wrong no or type of argument in line 1, column 7
Help with Resultset
Data transfer between tables