Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 61152 invoked from network); 9 Oct 2007 07:50:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2007 07:50:20 -0000 Received: (qmail 66240 invoked by uid 500); 9 Oct 2007 07:50:07 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 66213 invoked by uid 500); 9 Oct 2007 07:50:07 -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 66204 invoked by uid 99); 9 Oct 2007 07:50:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 00:50:07 -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, 09 Oct 2007 07:50:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 934AB714208 for ; Tue, 9 Oct 2007 00:49:50 -0700 (PDT) Message-ID: <21885161.1191916190571.JavaMail.jira@brutus> Date: Tue, 9 Oct 2007 00:49:50 -0700 (PDT) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3115) With embedded driver and autocommit, when closing a connection, updates on updatable result set are lost, unless result set is closed In-Reply-To: <1371482.1191845450832.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-3115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533297 ] Dag H. Wanvik commented on DERBY-3115: -------------------------------------- think the leniency ("implementation defined") in Dan's quote is there to allow for implementations that do not heed the SQL standard; that roll back an uncommitted transaction when closing the connection. In any case, for non auto-commit, Derby throws an exception when closing a connection while a transaction is active (although with different SQL states in network end embedded drivers, cf DERBY-2065). For auto-commit, neither the network client, nor embedded throws an exception, but behave differently (commit, rollback, respectively), which is confusing. We have three options to harmonize behavior: 1a) Continue to not throw an exception under auto-commit, but make embedded commit as the network client does. 1b) Continue to not throw an exception under auto-commit, but make network client roll back changes also. 2) Make both clients throw on close when open transaction also under autocommit (as per SQL Standard 17.3 GR 6). I think 1a) fits well with the auto-commit paradigm and is goes well with the JDBC4 model: close connection closes statements which in turn close result sets which in turn completes the SELECT statements, triggering auto-commit as per section 10.1 in JDBC4. Option 2) is also OK. I would recommend against 1b). What do you think? > With embedded driver and autocommit, when closing a connection, updates on updatable result set are lost, unless result set is closed > ------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-3115 > URL: https://issues.apache.org/jira/browse/DERBY-3115 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.3.1.4 > Reporter: Dag H. Wanvik > Attachments: Main.java > > > With autocommit, if an application neglects to close the result set > and/or the statement, the closing of the connection will lose any > updates performed via an updatable result set. > If autocommit is false, SQL state 25000 invalid transaction state will > be thrown, however. > The JDBC standard requires that statements be closed when the > connection is closed, cf. JDBC 4, section 9.4.4: "All Statement > objects created from a given Connection object will be closed when the > close method for the object is called." For updatable result sets, > closing the statement would lead to a closing of the result set, and > hence a commit of the updates. > For the network client it works as expected. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.