Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to code a transaction.
i676373_at_gmail.com wrote:
> i,
>
> How do I manually code an atomic transaction, given the following
> scenario?
>
> 1. User need to pay a fine.
> 2. User log into the system.
> 3. User click the pay button.
> 4. User pay by a custom payment methods called NETS (system operated
> through telephone line, in Singapore; it is not direct connection to a
> databse, but somekind of services.)
> 5. Payment/NETS transaction done; transaction cannot rollback after
> this.
> 6. System would update the database to indicate the fine have been
> paid.
>
> But step 6 might fail. How do I ensure that all the steps is in
> one single transaction?
Unless NETS has distributed transaction features you haven't described, you can't. You have to db-commit after step 3, with some kind of "transaction In doubt" flag. After step 5, you change it to either "transaction done" and db-commit that, or you change it to "transaction failed" (or do what is needed to achieve the same thing as rolling back rather than comitting at step 3 would have done) and db-commit that, depending the the manner in which step 5 completes.
You need to manually intervene on transactions that remain in doubt because steps 4 or 5 crashed without reporting either a success or a failure. (i.e. transaction is on doubt and time stamp is unreasonably long ago.)
> Is there any example/web page which show how to program a atomic
> transaction manually?
That would depend on what kinds of distributed transactions NETS will support, if any.
Xho
-- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GBReceived on Tue Mar 06 2007 - 11:19:49 CST
![]() |
![]() |