[DB-SIG] DCOracle2 in auto-commit mode ?

Anthony Tuininga anthony@computronix.com
26 Feb 2003 10:55:39 -0700


On Wed, 2003-02-26 at 10:45, M.-A. Lemburg wrote:
> Anthony Tuininga wrote:
> > SQL*Plus has autocommit but the OCI does not support it so it would have
> > to be coded explicitly in DCOracle for it to be available. 
> 
> Hmm, I don't think that you can code auto-commit in a client side
> interface. The point of auto-commit is that operations become
> atomic and any work-around on the client side would need to issue
> multiple commands in order to achieve the same effect, e.g.
> run .commit() after all .execute() calls.

Well, Oracle did it with SQL*Plus and others have done similar things.
And yes, after every statement that is executed the transaction is
committed. If this was built right in to the C portion of the driver I
think you'd have a hard time claiming it wasn't "atomic", unless you
insist that Oracle itself manage the concept -- which it doesn't.

Writing this in a layer in Python would imply something like the
following:

try:
    cursor.execute(statement, args)
    cursor.connection.commit()
except:
    cursor.connection.rollback()

That's about as good as you are going to get, I think. :-)

> > As mentioned,
> > DDL has an implicit commit in it and terminating the session will also
> > implicitly commit any outstanding changes.
> 
> You probably mean "rollback" here, right ? A connection should
> never do an implicit commit, only implicit rollbacks are allowed.

Actually, Oracle does an implicit commit, not an implicit rollback.
Execute SQL*Plus, issue an insert statement and then exit without doing
commit or rollback explicitly. The data will be committed.

> Thanks,
> -- 
> Marc-Andre Lemburg
> eGenix.com
> 
> Professional Python Software directly from the Source  (#1, Feb 26 2003)
>  >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
>  >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
> Python UK 2003, Oxford:                                     34 days left
> EuroPython 2003, Charleroi, Belgium:                       118 days left
-- 
Anthony Tuininga
anthony@computronix.com
 
Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada  T5N 4A3
Phone:	(780) 454-3700
Fax:	(780) 454-3838
http://www.computronix.com