db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmars...@Sourcery.Org>
Subject Problem closing statement after xa_end
Date Wed, 20 Oct 2004 21:43:21 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In Derby the default schema is a schema with the user name.
But until you create a table that schema doesn't actually exist.

In XA, a BrokeredStatement will try to create a new local connection if
the statement is used outside of an xa  connection, even if it is just
to close the statement. This causes a lock timeout trying to get the
default schema if the xa transaction created the first table in the
default (user) schema.

For example, the following code causes a lock timeout on stmt.close().
...


conn = xaConnection.getConnection();
Statement stmt = conn.createStatement();
xaResource.start(xid,XAResource.TMNOFLAGS);
// creating the first table creates the default
// schema which corresponds to the user
stmt.executeUpdate("create table mytab (i int)");
xaResource.end(xid,XAResource.TMSUCCESS);
xaResource.prepare(xid);

//Statement.close() tries to get the realConnection and finds it null so
// tries to create a new one and times out looking for the default
//schema descriptor. stmt.execute() etc. have the same problem
stmt.close();
			

Is this a bug or expected behaviour?

Thanks

Kathey

Here is the trace:

A lock could not be obtained within the time requested
ERROR 40XL1: A lock could not be obtained within the time requested
        at
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:295)
        at
org.apache.derby.impl.services.locks.LockSet.lockObject(LockSet.java:408)
        at
org.apache.derby.impl.services.locks.SinglePool.lockAnObject(SinglePool.java:168)
        at
org.apache.derby.impl.services.locks.SinglePool.lockObject(SinglePool.java:220)
        at
org.apache.derby.impl.store.raw.xact.RowLocking3.lockRecordForRead(RowLocking3.java:181)
        at
org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:425)
        at
org.apache.derby.impl.store.access.heap.HeapController.lockRow(HeapController.java:543)
        at
org.apache.derby.impl.store.access.btree.index.B2IRowLocking3.lockRowOnPage(B2IRowLocking3.java:32
        at
org.apache.derby.impl.store.access.btree.index.B2IRowLocking3._lockScanRow(B2IRowLocking3.java:571
        at
org.apache.derby.impl.store.access.btree.index.B2IRowLockingRR.lockScanRow(B2IRowLockingRR.java:11
        at
org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(BTreeForwardScan.java:374)
        at
org.apache.derby.impl.store.access.btree.BTreeScan.next(BTreeScan.java:1691)
        at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java
        at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1381)
        at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1
        at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initDefaultSchemaDescriptor(Generi
        at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.initialize(GenericLanguageConnecti
        at
org.apache.derby.impl.db.BasicDatabase.setupConnection(BasicDatabase.java:267)
        at
org.apache.derby.impl.jdbc.TransactionResourceImpl.startTransaction(TransactionResourceImpl.java:1
        at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:237)
        at
org.apache.derby.impl.jdbc.EmbedConnection20.<init>(EmbedConnection20.java:49)
        at
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:56)
        at
org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java:68)
        at org.apache.derby.jdbc.Driver169.connect(Driver169.java:172)
        at
org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:458)
        at
org.apache.derby.jdbc.EmbedPooledConnection.openRealConnection(EmbedPooledConnection.java:139)
        at
org.apache.derby.jdbc.EmbedXAConnection.getRealConnection(EmbedXAConnection.java:814)
        at
org.apache.derby.jdbc.XAStatementControl.getRealStatement(XAStatementControl.java:80)
        at
org.apache.derby.iapi.jdbc.BrokeredStatement.getStatement(BrokeredStatement.java:507)
        at
org.apache.derby.iapi.jdbc.BrokeredStatement.close(BrokeredStatement.java:123)
        at TestXA.main(TestXA.java:58)
$
			

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBdtv5G0h36bFmkocRAuNyAJ0Yyixa25SxmqNQPqNuJbBwdMA/owCeKRGq
3xMdVNtGuCQkP6EmOstPuos=
=QH5q
-----END PGP SIGNATURE-----

Mime
View raw message