Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 65085 invoked from network); 7 Apr 2009 03:59:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Apr 2009 03:59:36 -0000 Received: (qmail 85208 invoked by uid 500); 7 Apr 2009 03:59:35 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 85134 invoked by uid 500); 7 Apr 2009 03:59:35 -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 85126 invoked by uid 99); 7 Apr 2009 03:59:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 03:59:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [63.82.107.6] (HELO red.amberpoint.com) (63.82.107.6) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2009 03:59:28 +0000 Received: from [127.0.0.1] (john-emersons-macbook-pro-3.local [10.10.12.164] (may be forged)) by red.amberpoint.com (8.13.8/8.13.8) with ESMTP id n373x6o3018162 for ; Mon, 6 Apr 2009 20:59:06 -0700 Message-ID: <49DACF89.5000405@amberpoint.com> Date: Mon, 06 Apr 2009 20:59:05 -0700 From: Bryan Pendleton User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Derby Dev Subject: jdbc:default:connection and data modification statements (DERBY-2487) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org In my current investigation of DERBY-2487, I've been working with jdbc:default:connection, and mostly I've been successful. However, in some of my tests, I encounter an error: java.sql.SQLException: No current connection. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:103) at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Util.java:207) at org.apache.derby.impl.jdbc.EmbedConnectionContext.getNestedConnection(EmbedConnectionContext.java:113) at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:176) The crucial aspect of this error appears to be this code in EmbedConnectionContext: if ((sc == null) || (sc.getSQLAllowed() < org.apache.derby.catalog.types.RoutineAliasInfo.MODIFIES_SQL_DATA)) throw Util.noCurrentConnection(); Can anybody help me understand the logic behind this code? Alternatively, here's the problem I'm trying to solve: At the completion of statement execution, I'm gathering the runtime statistics regarding the statement, and I want to store that data into the XPLAIN tables in the database. To do this, I've been grabbing a connection using code like this: InternalDriver id = InternalDriver.activeDriver(); if (id != null) { Connection conn = id.connect("jdbc:default:connection", null); if (conn != null) return conn; } This generally succeeds in getting me a connection with which I can execute INSERT statements into the XPLAIN tables. However, in scenarios such as the following: at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:176) at org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.getDefaultConn(XPLAINSystemTableVisitor.java:2789) at org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.addStmtDescriptorsToSystemCatalog(XPLAINSystemTableVisitor.java:2805) at org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.doXPLAIN(XPLAINSystemTableVisitor.java:2730) at org.apache.derby.impl.sql.execute.NoRowsResultSetImpl.close(NoRowsResultSetImpl.java:375) at org.apache.derby.impl.sql.execute.InsertResultSet.cleanUp(InsertResultSet.java:2026) at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:512) at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:416) I get the "No current connection" thrown from the InternalDriver.connect method because my current statement context is not allowing a nested connection to be opened. Is there a better technique for getting an internal connection to use for storing the statistics data into the user tables? thanks, bryan