My suggestion is....
1. step 1 - insert row into oracle, do not perform commit
2. step 2 - delete the file from ftp site
3. if the file is deleted ok, send oracle commit, otherwise do not send
commit (which I would think this means the insert is removed???)
Although this is a simple solution, I don't think it will work since in
step
3 if the ftp fails, it is too late to not send the commit since the record
has already auto-committed. I assume that once the process that does the
insert closes, an auto-commit occurs.
Another solution is to add a column that represents a transaction complete
flag which I will update once the ftp delete is complete. Once again, the
problem arises that the ftp delete works, then I can't update the flag
since
the DB is unresponsive.
I thought I read somewhere that C# was going to support transactions in
the
future??
Clemens Reijnen said:
Chris,
I don't think you can get this opperation atomic, you have to make some
kind
of compensation code for it [just like biztalk long running transaction
compensation]. When one of the jobs fail there must be some custom
rollback
code who rollsback the other actoins. And to be more sure that the
actoins
will succeed you can write code wich checks if the operation will
succeed,
if the file excists if the db is available and that kind of things...
when
all checks give an ok, the code can preform the actions when one fails
the
compensation code will be executed. At a gotodtnet workspace I've put
some
code wich preforms that same steps to deploy and configurate a biztalk
solution... have a look.
http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=153aedcf-809f-4e6c-850a-9d13acfccc0a
greets Clemens
Chris Fink said:
I have the need to perform an atomic operation in two systems, a
database
and
an ftp site. The process is two step; 1. insert a row into oracle, 2.
delete
a file from a remote ftp site. I need to make these steps
atomic...either
they both succeed or both fail. Any suggestions on how I create a
transaction that bridges these two steps (systems) using C#?
Thanks in advance!