Solved

timeout mechanism in database component

Posted on 2002-07-18
5
195 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
compre toata in where clue oracle 4 56
Groovy:unable to resolve class error 2 70
jar file executable 12 42
Why my table column Id is not passed to java object? 4 25
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now