Hi, When during a query against a DB2 database a statement or lock timeout occurs, an SQLException is thrown, as expected. However the exception is not thrown from Statement.executeQuery but rather from ResultSet.next(), when the cursor moves to the record that could not be retrieved any more. This behavior seems a bit strange, but JDBC is not very specific about where such an exception could occur and when not. DB2 behaves like this and other RDBMS might as well.
Now the problem is that OJB's RsIterator silently swallows all exceptions thrown from ResultSet.next(). Thus the application receives a truncated query result and has no indication that something went awry. Is there a specific reason not to throw a PersistenceBrokerException that wraps SQLExceptions from ResultSet.next() in RsIterator? We patched the code as shown below and everything seemed to work ok: public synchronized boolean hasNext() { try { if (!isHasCalledCheck()) { setHasCalledCheck(true); setHasNext(getRsAndStmt().m_rs.next()); if (!getHasNext()) { autoReleaseDbResources(); } } } catch (Exception ex) { setHasNext(false); autoReleaseDbResources(); logger.warn("Calling ResultSet.next() failed", ex); if(ex instanceof ResourceClosedException) { throw (ResourceClosedException)ex; } else { throw new PersistenceBrokerException("Calling ResultSet.next() failed", ex); } } if (logger.isDebugEnabled()) logger.debug("hasNext() -> " + getHasNext()); return getHasNext(); } Gerhard --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]