[Zope-DB] Re: DCOracle2 Error: (1012, 'ORA-01012: not logged on')

Chris Withers chris at simplistix.co.uk
Mon Sep 22 12:56:12 EDT 2003

Matthew T. Kromer wrote:

> This error is curious, because it's coming from the commit or rollback 
> call to the database connection.

Indeed, that's the point I failed to make successfully ;-)

> This should only happen when that connection object is used during the 
> course of a transaction, ie someone DID something to the database.  Yet 
> then the database connection went away.  It's likely that Oracle was 
> restarted or someone closed the connection (contrary to Dieter's 
> experience, I've never seen Oracle crash).

This isn't Oracle being restarted, and it isn't Oracle crashing. But would you 
agree that something is happening mid-request to cause the Oracle connection to 
drop? What sort of things could the client (Zope/ZOracleDA,DCOracle2 in this 
case) do that would cause this to happen?

> The normal try/except pairing in ZOracleDA's code doesn't handle oracle 
> errors arising during commit or rollback.  I'd argue it's PROBABLY doing 
> the right thing letting it complain about this, since the proper time to 
> notice the database went away was before trying to commit or abort.


> Having said that, if you want to monkey with the DA code a little bit, 
> there IS support for two-phase commit in DCOracle2, just not in 
> ZOracleDA.  What you'll need to do is catch the tpc_vote call and then 
> do a connection.prepare(), and then I think you also need to change the 
> connection.commit() to connection.commit(twophase=1) [n.b. I'm not sure 
> if you don't have to commit twice, once with twophase=1 and once without].

Would you mind if I made these changes (and some other bug fixes that people 
have suggested) on a branch in CVS, ready for you to review, merge and release?

> The tpc_vote phase is allowed to raise an error, and the 
> connection.prepare() should see that the connection to Oracle is down 
> just like the commit/rollback sees.

OK, what would be the downsides of doing it like this? (ie, why wasn't it 
implemented this way to start off with? ;-)



More information about the Zope-DB mailing list