[EMAIL PROTECTED] wrote:
> 
> I am very much a self taught sql programmer, and I only use it for a
> few small projects at home.  Work requires just a bit of db work on my
> part, there are others who do the heavy lifting :-)
> 
> I was surprised when one of my heavy lifting co-workers told me that
> when a transaction is begun, if the client disconnects (program bug,
> computer crash, whatever) without doing an explicit commit or
> rollback, the default in both Oracle and Sybase, and probably in every
> SQL database, is to commit.  This seems completely backwards to me.
> For instance, the example from Practical SQL Handbok of transferring
> money from one account to another, you sure don't want any changes at
> all if the client disconnects after having subtracted money from one
> account but before having added that same amount to the second
> account.
> 
> Could someone enlighten me here?  He seemed absolutely positive that
> a disconnect is as good as a commit and always has been.

>From the Oracle 7 SQL Language Reference Manual:

"Oracle Corporation recommends that you explicitly end every
transaction your application programs with a COMMIT or ROLLBACK
statement,including the last transaction, before disconnecting
from ORACLE. If you do not explicitly commit the transaction and
the program terminates abnormally, the last uncommitted
transaction is automatically rolled back. 

A normal exit from most ORACLE utilities and tools causes the
current transaction to be committed. A normal exit from an ORACLE
Precompiler program does not commit the transaction and relies on
ORACLE to rollback the current transaction. See the COMMIT
command (Embedded SQL) in the next section."

So, apparently, your friend is assuming that since SQL*Plus is
performing a COMMIT when the user exits normally, all
transactions are being committed on disconnect. This is most
definitely NOT true. You're right to feel your friend's
statements were completely backwards.

Hope that helps, 

Mike Mascari


> 
> --
>             ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
>      Felix Finch: scarecrow repairman & rocket surgeon / [EMAIL PROTECTED]
>   GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
> I've found a solution to Fermat's Last Theorem but I see I've run out of room o

Reply via email to