You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Knut Anders Hatlen <Kn...@Sun.COM> on 2008/01/02 11:20:52 UTC

Re: Current transaction ID

Eric Long <el...@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");
  System.out.println(c);

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