db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Current transaction ID
Date Wed, 02 Jan 2008 10:20:52 GMT
Eric Long <elong@alstongrove.com> writes:

> Is there a way to determine the current transaction ID being used?  I can see all
> transaction IDs by using "SELECT * FROM SYSCS_DIAG.TRANSACTION_TABLE", but I want a way
> to return the transaction ID for the current connection.

There might be a simpler way, but at least EmbedConnection.toString()
returns a string which contains the transaction ID.

This code

  Connection c = DriverManager.getConnection("jdbc:derby:db;create=true");

will print something similar to this:

org.apache.derby.impl.jdbc.EmbedConnection40@9045316 (XID = 120), (SESSIONID = 0), (DATABASE
= db), (DRDAID = null)

XID = 120 shows that the transaction ID is 120.

Knut Anders

View raw message