Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 99200 invoked from network); 8 May 2007 17:49:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2007 17:49:39 -0000 Received: (qmail 23016 invoked by uid 500); 8 May 2007 17:49:43 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 22985 invoked by uid 500); 8 May 2007 17:49:43 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 22966 invoked by uid 99); 8 May 2007 17:49:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2007 10:49:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2007 10:49:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7ED4C714064 for ; Tue, 8 May 2007 10:49:15 -0700 (PDT) Message-ID: <3738091.1178646555517.JavaMail.jira@brutus> Date: Tue, 8 May 2007 10:49:15 -0700 (PDT) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2620) embedded throws SQLState 8003 (No current connection) on rs.next() on closed resultSet in test for DERBY-1025 in DataSourceTest In-Reply-To: <21616169.1178568075278.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494353 ] Kathey Marsden commented on DERBY-2620: --------------------------------------- The reason for the error is that xa_end sets the application connection to null.Then on the first operation outside of the global xact,for instance calling Connection.isClosed() or createStatement() it will make a call to BrokeredConnection.getRealConnection() which will create a new EmbedConnection if the realConnection is null. However for operations on existing resultSets we get the 8003 error because the ResultSet is still linked to the BrokeredConnection whose realConnection is still null. Question: 1) Should the ResultSet created before a global transaction be usable after a global transaction? If not we could just change EmbedResultSet.checkExecIfClosed() to throw SQLState.LANG_RESULT_SET_NOT_OPEN if the connection is null. There are likely other places e.g. Statement objects where similar changes would need to be made. > embedded throws SQLState 8003 (No current connection) on rs.next() on closed resultSet in test for DERBY-1025 in DataSourceTest > ------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-2620 > URL: https://issues.apache.org/jira/browse/DERBY-2620 > Project: Derby > Issue Type: Bug > Components: JDBC > Reporter: Kathey Marsden > Assigned To: Kathey Marsden > > The following code checking that a CLOSE_CURSORS_AT_COMMIT ResultSet is closed by xa_start throws the wrong exception for embedded, indicating that there is no current connection instead of the ResultSet being closed. > Statement s4 = conn4.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.CLOSE_CURSORS_AT_COMMIT); > ResultSet rs4 = s4.executeQuery("select i from autocommitxastart"); > rs4.next(); > assertEquals(1, rs4.getInt(1)); > rs4.next(); > assertEquals(2, rs4.getInt(1)); > // XAResource().start should commit the transaction > try { > xac4.getXAResource().start(xid4a, XAResource.TMNOFLAGS); > xac4.getXAResource().end(xid4a, XAResource.TMSUCCESS); > } catch (XAException xae) { > fail("unexpected XAException on xac4.getXAResource.start or end"); > } catch (Exception e) { > fail("unexpected Exception on xac4.getXAResource.start or end"); > } > > // DERBY-1025. > // With Embedded, this will give error: 08003 - No current connection > // But with NetworkServer / DerbyNetClient, the transaction does not > // appear to be closed, and we actually get a value. > try { > rs4.next(); > rs4.getInt(1); > fail ("expected an exception indicating resultset is closed."); > } catch (SQLException sqle) { > // Embedded gets 08003. > if (usingDerbyNetClient()) > assertSQLState("XCL16",sqle); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.