aspose file tools*
The moose likes JDBC and the fly likes Trying to set query timeout for PreparedStatement object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Trying to set query timeout for PreparedStatement object" Watch "Trying to set query timeout for PreparedStatement object" New topic
Author

Trying to set query timeout for PreparedStatement object

Susan Smith
Ranch Hand

Joined: Oct 13, 2007
Posts: 224
Hi,

I'm trying to set query timeout for a PreparedStatement object (below is the code snippet).
I set the query timeout to "1" second just for testing first. But I notice the query takes longer than 1 second but it is successfully executed. No SQLException is thrown. I'm confused why this doesn't work. Can someone please advise?



Thanks in advance for all the help.
Susan Smith
Ranch Hand

Joined: Oct 13, 2007
Posts: 224
Hi,

Sorry to bother you guys again.
Just want to follow up if anyone knows some pointers to my question.

Thanks again in advance for the help.
Let me know if I can provide more information.
Rich Remington
Greenhorn

Joined: Sep 13, 2009
Posts: 1
I just read that the timing (when the timeout exception is thrown) is not very precise and may take a few seconds to actually materialize. Your query may have completed before then.

Here is a reference URL for your reading pleasure -> http://forums.oracle.com/forums/thread.jspa?threadID=550257

HTH

Susan Smith wrote:Hi,

Sorry to bother you guys again.

...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19791
    
  20

No idea why I haven't moved this thread before, but it clearly belongs in our JDBC forum. Finally moving it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


No idea why I haven't moved this thread before, but it clearly belongs in our JDBC forum. Finally moving it.

yeah certainly would have triggered better responses in JDBC.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trying to set query timeout for PreparedStatement object