java - Putting timeouts on Prepared statements -
I am trying to use a prepared statement that works on a far-off database, with considerable interval and unreliability Included is the network connection used to access this database. Downtime for one minute is common. The problem is that in the case of such a failure, if my program tries to execute a prepared statement, the whole thread goes in an endless wait, it never goes out and is just waiting for the response from the database .
I tried to use the setQueryTimeout () method explicitly from time to time, but it seems that there is some problem in this method in which this work Can not do, if the network fails
Is there any alternative way to do this?
Appendix
Using a thread monitor which is another Monitor the execution of threads and kills 'trapped' threads. It may be a bad idea why this kind of activity should be avoided, it will help answer.
Comments
Post a Comment