Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 10115 invoked from network); 23 Jun 2005 17:17:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jun 2005 17:17:32 -0000 Received: (qmail 10698 invoked by uid 500); 23 Jun 2005 17:17:32 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 10611 invoked by uid 500); 23 Jun 2005 17:17:31 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 10598 invoked by uid 500); 23 Jun 2005 17:17:31 -0000 Delivered-To: apmail-incubator-ibatis-dev@incubator.apache.org Received: (qmail 10595 invoked by uid 99); 23 Jun 2005 17:17:31 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2005 10:17:31 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 4C9E113 for ; Thu, 23 Jun 2005 19:17:30 +0200 (CEST) Message-ID: <79606791.1119547050312.JavaMail.jira@ajax.apache.org> Date: Thu, 23 Jun 2005 19:17:30 +0200 (CEST) From: "Patrick Idem (JIRA)" To: ibatis-dev@incubator.apache.org Subject: [jira] Updated: (IBATIS-109) Make PaginatedList work with IBM's broken JDBC driver In-Reply-To: <733583758.1113596417333.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/IBATIS-109?page=all ] Patrick Idem updated IBATIS-109: -------------------------------- Attachment: SqlExecutor.java I have attached an update to the com.ibatis.sqlmap.engine.execution.SqlExecutor class to solve the problem that can occur if handleResults is called with a skip value that is greater than the number of records in the returned resultSet. I simply replaced the "break;" statement on line 368 wtih a "return;" statement. > Make PaginatedList work with IBM's broken JDBC driver > ----------------------------------------------------- > > Key: IBATIS-109 > URL: http://issues.apache.org/jira/browse/IBATIS-109 > Project: iBatis for Java > Type: Improvement > Components: SQL Maps > Versions: 2.0.8, 2.0.9, 2.1.0, 2.1.2, 2.1.1, 2.0.9b > Environment: Any Java environment > Reporter: Patrick Idem > Priority: Minor > Attachments: SqlExecutor.java > > Using DB2 database drivers cases an exception to be thrown when calling paginatedList.next() and the current page is the page before the last page. From what I can determine the PaginatedList class retrieves future records in order to determine if there are any more pages. An Exception will be caused in the following situation: > A database table has 11 records. > First issue a command to get a paginated list of all the records with a page size of 10: > PaginatedList list = queryForPaginatedList("getAllRecords", null, 10) > Since the paginated list reads ahead it will retrieve all 11 records and reach the end of the ResultSet. > Now if we want to view the second page (which only consists of 1 record) we would then do the following: > list.next() > Now, calling list.next() should not have to go to the database since we had already reached the end of the ResultSet but it does! This is where the problem happens. DB2 drivers automatically close the ResultSet when you read in the last row so the ResultSet has been closed. > I am suspecting that this problem is only serious when using DB2 drivers but it is still a problem. The paginated list object should be smart enough to know that there are no more results and not try to hit the database that last time. > The actually DB2 exception that is thrown is the following: > com.ibm.db2.jcc.a.SqlException: Invalid operation: result set closed -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira