Solved

timeout mechanism in database component

Posted on 2002-07-18
5
200 Views
Last Modified: 2010-03-31
i have a database component called JDBCController. i need some suggestions on timeout mechanism in this component. this is the problem that i faced:

let say i do a select statement (using say method executeQuery in JDBCController) to select a record. suppose if that particular record is locked by some other applications and it is never release the lock. the method executeQuery will also be blocked indefinitely. as such, it is important to make sure that any request will not be blocked indefinitely.

any suggestions on this?
0
Comment
Question by:emily_my
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
yongsing earned 50 total points
ID: 7164170
You can use the setQueryTimeout() method in the Statement object to specify the number of seconds to wait for it to execute the query. If the limit is exceeded, an SQLException is thrown.
0
 

Author Comment

by:emily_my
ID: 7167961
thanks yongsing,

is this method really effective? do you think it is better to also configure on the database side?
0
 
LVL 9

Expert Comment

by:yongsing
ID: 7168493
I have not tried it before, but you can always test it out. You can try configuring the database as well, but you should program your application such that it knows that a timeout has occurred when an SQLException is thrown.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8951544
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to yongsing

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question