Women in Technology

Hear us Roar



Article:
  Interruptible Database Queries
Subject:   What about the the ResultSet?
Date:   2004-07-29 06:38:11
From:   tailormade
First: Maybe there is a bug in the library. I'm not sure. I'm using the jt400 library for IBM's AS400 machines.


What is with the ResultSet? How should it react if the Thread is interrupted? In my case, when the Thread gets interrupted, very often the method next() of the ResultSet in concerned and throws an SQLException. Within the the message of this exception the String java.lang.InterruptedException is contained. And if I catch the exception and check the interruption state with the Thread.isInterrupted() method, I get false. This makes me bit wondering what is going on there. But I am not an expert. Maybe I misunderstand something.


So what should normally happen, if the Thread is interrupted while the methode ResultSet.next() is called. Or what could I do?


And could it be a bug or an poor implementation in the library? Is it possible, that (unfortunately) within the library the Thread.interrupted() methode is called, so the flag is already set to false?


Thanks for a hint in advance,
Robert