ITransactionImport::import method error
Hello everybody, I need a little help in order to investigate an Error using ITransactionImport::import method.
It seems that the transaction cookie used in several transaction operations become invalid if one of this operation fails without an explicit operation by our side.
We need to perform 4 database operations in the same transaction, the first operation is completed with success, the second operation fail due to a Timeout expired, we retry the same operation for three or four times and at last the operation end with success, when we try to execute third operation the ITransactionImport::import method fails with the following error 0x8004D00EL "The transaction has already been implicitly or explicitly committed or aborted".
We share the same cookie in all 4 methods.
Can someone supply us a little help in order to better understand this behaviour?
Thank you in advance
Best regards
When you call ITransactionExportFactory::Create() you provide the whereabouts of the resource manager (i.e. the database); this factory is then used to create the cookie. I assume that you are using the same database for each of the four "database operations", otherwise the cookie is not necessarily valid for all of the databases.
The second part of your story is confusing, so I will try to guess what has happened. The first attempt to import the transaction succeeds; but by the time you try to import the transaction for the second database operation, the import fails because the transaction has timed out. When you try importing the transaction for the third database operation, the transaction has already timed out and thus you get the error as mentioned above.
[Note: I assume that the "operations" that you discuss are transaction import operations (ITransactionImport::Import() calls) and not database operations, because if you are using a transaction either all of the database operations should succeed or none of them. ]
I am not sure why your transaction has timed out. Maybe it is because you have set a very short timeout period when you created the transaction; maybe this is explained by the fact that you are retrying "the same operation three or four times".
Some questions you should ask yourself that might provide some insight: How are you setting your transaction timeout, and what is its value? Do you create the transaction or are you getting it from somewhere else? Are the client app and the databases all on the same machine or are they on different machines?
I hope this helps.
-Richard