Pergunta

In classic ASP, what happens to a Connection transaction if the page experiences an uncaught exception and stops before commit/rollback?

For example:

conn.BeginTrans

a = 0 / 0

conn.CommitTrans

Seeing as the transaction is in progress, will it be aborted or committed? Or will the connection maintain the transaction when it's returned to the connection pool?

Foi útil?

Solução

To return to the connection pool the connection, implicitly or explicitly, should be considered closed. Any transaction pending on connection close will rollback.

BUT while the connection is considered active, the resources/locks adquired in database will still be maintained.

EDIT - From information located by Shadow Wizard (thank you) relative to ADO connection objects: here

Closing a Connection object while there are open Recordset objects on the connection rolls back any pending changes in all of the Recordset objects. Explicitly closing a Connection object (calling the Close method) while a transaction is in progress generates an error. If a Connection object falls out of scope while a transaction is in progress, ADO automatically rolls back the transaction

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top