• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to specify time out for a query

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic