This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Detecting inifite looping of Stored proc

 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, wouldn't it be easier to just fix the bug? Why do you want to work around it?
 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked perfectly for me. Thanks much!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic