Question

I have a very strange problem with transactions in Interbase 7.5 which seem to be stuck.

I can track the problem with IBConsole -> right click DB -> Performance Monitor -> Transactions

Usually this list should show only a few active transaction. But I get several hundred active transactions when I start my application (a web module for an apache webserver using Delphi 7 Interbase components, e.g. IBQuery, IBTransaction, ...)

Transaction type is always listed as snapshot, if this is of relevance.

I have already triple checked all sql statements and cannot find anything that should produce such problems...

Is there any way get the sql statements of a specific transaction?

Any other suggestion how to find such a problem would be very welcome.

Was it helpful?

Solution

Is there any way get the sql statements of a specific transaction?

Yes, you can SELECT from TMP$STATEMENTS WHERE TRANSACTION_ID = .... That's from memory, but should get you started.

In IB Performance Monitor, you can locate the transaction from the statements tab, using the button on the toolbar. Can't remember if you can go the other way in that app. It's been a long time since I wrote it!

OTHER TIPS

Active IBX data-sets require an active transaction all the time. If you don't have active data-sets just don't forget to commit all the active transactions.

If you have active data-sets, you can configure all your components to use the same TIbTransaction object, and you can also configure the unique TIbTransaction to commit or rollback after a idle time-out period via the IdleTimer and DefaultAction properties.

Terminating the transaction (by manually or automatically committing or rolling back) will close all the linked datasets (TIBQuery, TIBTable and the like).

You may be tempted to use the CommitRetaining or RollbackRetaining methods to terminate the transaction without closing the related data-sets, but this may affect the performance of the server, and my advise is to always avoid using it.

If you want to improve your application, you should consider changing your database connection layer or introducing a in-memory capable dataset over IBX, for example, Delphi's TClientDataSet, which allows you to retrieve data and retain it in memory while closing all the underlying datasets (and transactions), while allowing you to use the traditional Insert/Append/Edit/Delete methods to modify the data and then apply that changes to the database in a new short-time transaction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top