Behavior If NuoDB Throws an Exception
During a transaction, if NuoDB throws an exception that does not close the connection then the client application can do any of the following:
-
Roll back the entire transaction or to a save point in the transaction.
-
Rerun the statement that caused the exception.
-
Run other statements.
Transactions remain active until the connection is closed or the user performs an appropriate action.
However, NuoDB does roll back active connections in the following scenarios:
-
When a transaction is part of a deadlock cycle and has been selected as the victim.
-
When acquisition of a transactional lock has failed and the transaction is left in an unknown state.
A statement can fail with an exception, but the transaction remains in progress. This is important in case of deadlocks. A transaction that was part of a deadlock is not automatically rolled back. |
Some NuoDB client drivers provide exception types that represent conditions for which retrying the transaction is expected and acceptable. There are other exception types that indicate that some action on the part of the client application is required before the transaction can be retried. For example, the NuoDB JDBC driver provides transient and non-transient SQL exceptions. Upon catching a transient exception, a client application can simply retry the transaction with an expectation that it would succeed. For details, see the documentation for the driver you are using.
A client application can sometimes be unable to establish a connection or re-establish a connection. This also causes an exception to be thrown, which the client application must handle. If the client application is using the NuoDB JDBC driver then it is possible that such an exception would cause another connection in the pool to be tried. |