You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dag H. Wanvik" <da...@oracle.com> on 2011/01/31 21:26:27 UTC
Error? Nested connection not marked as closed after session level error
Inside a stored procedure, with a nested connection:
Connection c = DriverManager.getConnection("jdbc:default:connection");
I see a session level error:
} catch (SQLException e) {
assertSQLState("expected CONN_INTERRUPT", "08000", e);
assertTrue(c.isClosed());
However, the second assert above fails. Granted, we are still executing
inside the stored routine, but the statement is now "dead"; the calling
statment will see exception 40XC0 (dead statement) and the parent
connection will then be marked as closed (as expected).
But shouldn't the nested connection also be marked closed at this time?
If I try to do something with the connection at this point, e.g. trying
to prepare a new statement I see a NPE because the lcc is already gone:
Caused by: java.lang.NullPointerException
at org.apache.derby.impl.sql.compile.CompilerContextImpl.initRequiredPriv(CompilerContextImpl.java:717)
at org.apache.derby.impl.sql.compile.CompilerContextImpl.<init>(CompilerContextImpl.java:702)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.pushCompilerContext(GenericLanguageConnectionContext.java:2355)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:236)
at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:91)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1101)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:610)
I'll file an issue if you agree ;-)
Thanks,
Dag
Re: Error? Nested connection not marked as closed after session level
error
Posted by Rick Hillegas <ri...@oracle.com>.
Hi Dag,
I would expect the nested connection to close when the outer connection
closes.
Thanks,
-Rick
On 1/31/11 12:26 PM, dag.wanvik@oracle.com wrote:
> Inside a stored procedure, with a nested connection:
>
> Connection c = DriverManager.getConnection("jdbc:default:connection");
>
> I see a session level error:
>
> } catch (SQLException e) {
> assertSQLState("expected CONN_INTERRUPT", "08000", e);
> assertTrue(c.isClosed());
>
> However, the second assert above fails. Granted, we are still executing
> inside the stored routine, but the statement is now "dead"; the calling
> statment will see exception 40XC0 (dead statement) and the parent
> connection will then be marked as closed (as expected).
>
> But shouldn't the nested connection also be marked closed at this time?
>
> If I try to do something with the connection at this point, e.g. trying
> to prepare a new statement I see a NPE because the lcc is already gone:
>
> Caused by: java.lang.NullPointerException
> at org.apache.derby.impl.sql.compile.CompilerContextImpl.initRequiredPriv(CompilerContextImpl.java:717)
> at org.apache.derby.impl.sql.compile.CompilerContextImpl.<init>(CompilerContextImpl.java:702)
> at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.pushCompilerContext(GenericLanguageConnectionContext.java:2355)
> at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:236)
> at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:91)
> at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1101)
> at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:610)
>
> I'll file an issue if you agree ;-)
>
> Thanks,
> Dag
>
>
>
>