Solved

timeout mechanism in database component

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 121
spring jars download 1 52
runtime exception 2 50
jsp insert to database example 2 58
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

679 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