This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi all, I have a small problem.my need is I have to query a database and wait for 15 seconds(timeout value). If time out occurs, then i have to again issue the same query (with same 15 seconds as timeout).I must repeat this process 4 times(if in case every query fails due to some reason). My doubt is how I can check whether there is a timeout or any other issue.It is given as it will throw a SQLException when timeout occurs but SQLException can occur due to other causes also. Can anyone suggest some way of doing this.
You'd have to spawn a separate thread that queries the database. Once its finished querying the database it populates some output string/object/boolean. You main thread would just wait 15 seconds and if doesn't see this output object populated, would kill the thread and create a new one.