File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to specify time out for a query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "How to specify time out for a query" Watch "How to specify time out for a query" New topic
Author

How to specify time out for a query

giang nguyen
Ranch Hand

Joined: May 13, 2003
Posts: 42
Hi all,
I've blending my mind with how to specify the time out for a select query. Some time, because of problem in DB server, the SQLQuery keep hanging without throwing any SQLException. This result in user having to wait an infinite amount of time.
Does any of you have any idea on how make JDBC queries time-out aware ? or in general how to make a method calling a time-out based operation ?
Thanks a lot.


SCJP 1.4, SCWCD
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
You could wrap the JDBC call in a UserTransaction and call setTransactionTimeout. But I'd be looking at the DB and sort out whatever problem is the cause. DBs should not just hang.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to specify time out for a query
 
Similar Threads
How To Convert GMT
How can I make this query take less time?
Query Execution Time.
Dirty read problem?
IP Address???